Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!wuarchive!zaphod.mps.ohio-state.edu!mips!smsc.sony.com!dce From: dce@smsc.sony.com (David Elliott) Newsgroups: comp.sys.mac.programmer Subject: Re: C function ptrs & Mac mem segments Message-ID: <1990May2.144237.2978@smsc.sony.com> Date: 2 May 90 14:42:37 GMT References: <3550@dogie.macc.wisc.edu> <5524@helios.ee.lbl.gov> Reply-To: dce@Sony.COM (David Elliott) Organization: Sony Microsystems Corp. Lines: 27 In article <5524@helios.ee.lbl.gov> beard@ux1.lbl.gov (Patrick C Beard) writes: >Another point: Even if the segment was unloaded, THINK C (and most other >C compilers for the Mac that I've used) generates function pointers as >pointers to jump table entries. When you call a function by jump table, >the segment is automatically loaded into memory (by the segment loader). This is good news. >As long as the jump table stays in memory, you don't have to worry about >the staleness of the pointers in your structure. How can this be assured? For example, if one implements a new class that has programmer-defined callbacks associated with it, how does one save the callback function pointers so that these are assured to be there? I guess the real questions are: How do you make sure that the jump table stays in memory? What do you do if the jump table goes away? -- David Elliott dce@smsc.sony.com | ...!{uunet,mips}!sonyusa!dce (408)944-4073 "Nature hates both a vacuum and a vacuum cleaner too" -- The Residents