Xref: utzoo comp.sys.ibm.pc:10326 comp.sys.mac:10667 comp.sys.atari.st:6835 Path: utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!decvax!decwrl!pyramid!mips!prls!gardner From: gardner@prls.UUCP (Robert Gardner) Newsgroups: comp.sys.ibm.pc,comp.sys.mac,comp.sys.atari.st Subject: LSC, function pointers, and segments Message-ID: <8217@prls.UUCP> Date: 5 Jan 88 00:29:25 GMT References: <782@daisy.UUCP> <22358@ucbvax.BERKELEY.EDU> Reply-To: gardner@prls.UUCP (Robert Gardner) Organization: Philips Research Labs, Sunnyvale, California Lines: 19 I started working on segmenting a large program that uses function pointers rather extensively and got worried about assigning a function pointer in one segment, unloading that segment, and having it accessed later from another segment. Is the function pointer still valid? Interestingly, when I step through the code with TMON I noticed that when the function pointer is used it is called via JSR (A0), as expected, but the next function called is something like JMP xx(A5), which is usually the type of call you see in the jump table for a loaded segment, which is replaced by _LoadSeg if the segment is unloaded. (I haven't yet had time to see what it says when the segment is unloaded.) So, it appears that the function pointer should still be valid, even if the segment containing the function gets unloaded. I would like to know if this is true, even for static functions, and if so, what kind of magic makes it possible. Thank you, Robert Gardner