Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!apple!voder!kontron!optilink!cramer From: cramer@optilink.UUCP (Clayton Cramer) Newsgroups: comp.sys.ibm.pc Subject: Overlays & Function Pointers Message-ID: <542@optilink.UUCP> Date: 4 Oct 88 18:07:07 GMT Organization: Optilink Corporation, Petaluma, CA Lines: 22 Consider this a warning. I was having trouble getting overlays to work with the Microsoft C V5.1 compiler, and after talking to Microsoft Customer Support, and eventually to someone in the Microsoft Languages Group, my boss pointed out the source of the problem. This is an obscure enough problem that even the engineer in the Languages Group needed it explained in detail to understand it. If you directly call a function which is overlayable, the Microsoft linker will correctly replace the call with an INT 3FH ... instruction to invoke the Overlay Manager. If you call a function indirectly (i.e. the function pointer is stored in a table, and you call through that function pointer) the Microsoft linker can't replace that function pointer with an INT 3FH call, because there isn't a CALL instruction there -- just an address. As a consequence, the overlay manager isn't invoked, and whatever code happens to be in the overlay area when the indirect call is made will be executed. (This is almost never the code you really want). -- Clayton E. Cramer ..!ames!pyramid!kontron!optilin!cramer