home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!vnet.ibm.com
- From: pgainer@vnet.ibm.com (Patrick Gainer)
- Message-ID: <19920727.073431.240@almaden.ibm.com>
- Date: Mon, 27 Jul 92 10:28:50 EDT
- Newsgroups: comp.unix.aix
- Subject: Re: A better dynamic loader???
- Organization: IBM - Toronto Lab
- Disclaimer: This posting represents the poster's views, not those of IBM
- News-Software: UReply 3.0
- References: <45628@shamash.cdc.com>
- <1992Jul25.073355.7669@pencom.com>
- Lines: 31
-
- In <1992Jul25.073355.7669@pencom.com> Mike Heath writes:
- >In article <45628@shamash.cdc.com> pbd@runyon.cim.cdc.com (Paul Dokas) writes:
- >>I need to be able to execute dynamically loaded modules from within another
- >>program, but I can't seem to find the needed functionality anywhere. What I
- >>have right now is a program that uses load() to pull in a module and then it
- >>calls the function pointed to by the return value of load(). This works
- ....
- >
- >You could either use loadquery() to get the module names, or better yet,
- >at the time of each load() call (though, you'll still have to account for
- >the shared libraries loaded at exec() time), open the file manually and
- >grab all the exported symbols and their addresses (Loader symbol table).
- >You'll have to "relocate" the addresses using the value returned by load().
- >
- >For performance reasons, you'll want to retain all these values for
- >multiple calls, plus, you'll want to memory map the object files
- >when you scan the Loader Symbol Table.
- >
- >--
- >Mike Heath Pencom ... We're not just headhunters anymore.
-
- An easy way to do this is to use load(), as Mike says, then to call nlist()
- which returns offsets of functions within a single object module, then
- calculate the function addresses from the offsets returned by nlist() and
- the entry point returned by load().
-
- I happen to have some code which does exactly what you want - I'll send it
- to you if you'd like.
-
- Patrick Gainer
- pgainer@vnet.ibm.com
-