home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / question / 14876 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.3 KB  |  38 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!usenet-feed.cc.umr.edu!mcs213e.cs.umr.edu!mcastle
  3. From: mcastle@mcs213e.cs.umr.edu (Michael R Castle)
  4. Subject: Re: QUERY: How do I load .o files and execute them at run time?
  5. References: <11503@uqcspe.cs.uq.oz.au>
  6. Date: Tue, 22 Dec 1992 05:42:34 GMT
  7. Nntp-Posting-Host: mcs213e.cs.umr.edu
  8. Organization: University of Missouri - Rolla
  9. Sender: cnews@umr.edu (UMR Usenet News Post)
  10. Message-ID: <1992Dec22.054234.10076@umr.edu>
  11. Lines: 25
  12.  
  13. In article <11503@uqcspe.cs.uq.oz.au> muzzle@cs.uq.oz.au writes:
  14. >Hi there
  15. >
  16. >I'm doing research into distributed and concurrent systems, and I'm trying to
  17. >write a program which will load in a .o file and then execute functions
  18. >from that file.
  19. >
  20. >I've got the (struct exec) stuff read in (as described in a.out.h), but I'm
  21. >unsure how to access the symbol/string tables, and how to convert a_entry field
  22. >to an address to jump to.
  23.  
  24. You might consider getting the DLD (Dynamic Link Editory) library.  It does 
  25. exactly this.  It's an GNU library, and so should be at you local GNU archive
  26. site.  The file is, I believe, dld-3.2.3.tar.Z. 
  27.  
  28. You would do something like:
  29.  
  30. dld_link("file.o");
  31. func = get_func("func_name");
  32. (*func) (parm1, parm2, ... parmN);
  33.  
  34. Of course, some error checking in there might save a few core dumps :->.
  35.  
  36. regards,
  37. mrc
  38.