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