Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!decvax!ima!mirror!mguyott From: mguyott@mirror.UUCP (Marc Guyott) Newsgroups: comp.windows.ms Subject: Re: Indirect function calls Message-ID: <23822@mirror.UUCP> Date: 3 Mar 89 18:52:14 GMT References: <6970002@hpmcaa.HP.COM> Reply-To: mguyott@prism.TMC.COM (Marc Guyott) Organization: Mirror Systems, Cambridge Mass. Lines: 35 In article <6970002@hpmcaa.HP.COM> marco@hpmcaa.HP.COM (Marco Dalla-Gasperina) writes: >What are the possibilities of using indirect function calls like > > x= (*foo)(14); > >in windows? Does windows itself have a mechanism that we can use >or are they totally out of the question like retaining far pointers >to memory blocks... > >I guess I'm interested in far calls. As long as you specified the Windows compiler flags and you define the actual function as "far" you should have no problems with indirect function calls. The address that is indicated by the name of a "far" function is actually the address of a reload thunk in the entry table for your program. Windows keeps this table in one of two fixed segments that it builds for each program when the program is initially loaded. Making an indirect call will still go to the reload thunk which will load the appropriate code segment if it is not already in memory (or cause the correct routine to be called even if the code segment has moved in memory). For a more detailed explanation I recommend that you look at the section called "Windows Runs the Program" on pages 300 and 301 of Charles Petzold's "Programming Windows" book. I think he does a nice job of explaining what Windows does when relocating code and data segments. I hope this helps. Marc ---- "All my life I always wanted to BE somebody. I see now I should have been more specific." Jane Wagner Marc Guyott mguyott@mirror.TMC.COM {mit-eddie, pyramid, harvard!wjh12, xait, datacube}!mirror!mguyott Mirror Systems Cambridge, MA 02140 617/661-0777