home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / aix / 8212 < prev    next >
Encoding:
Internet Message Format  |  1992-07-27  |  1.9 KB

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