Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!uunet!shelby!agate!gaia.berkeley.edu!kemnitz From: kemnitz@gaia.berkeley.edu (Greg Kemnitz) Newsgroups: comp.unix.wizards Subject: Re: dynamic linking C code with ld link editor Message-ID: <1991Feb13.200448.20517@agate.berkeley.edu> Date: 13 Feb 91 20:04:48 GMT References: <23713@netcom.COM> <23325@ttidca.TTI.COM> Sender: usenet@agate.berkeley.edu (USENET Administrator) Reply-To: kemnitz@gaia.berkeley.edu (Greg Kemnitz) Organization: University of California, Berkeley Lines: 22 I had this problem for several months until (after much hacking) I got my dynamic loaders to work with Postgres. It is a rather different idea than shared libraries - the idea is to load and execute a function (whose name is unknown beforehand) in an object file given by the user. It is quite tricky, since you have to know about the a.out format, and getting it to work requires using lots of undocumented or almost undocumented features and options (especially on DECstations). Also, Postgres had to be able to unload and reload a user function (since the user may have changed it) which is easy but not entirely straightforward. I have two versions - one for Sun 3's, Sparcs, and Sequents, and another version for DECstations running Ultrix >= 4.0. They all use "ld -A", but there's lots of stuff you need to know that you only discover after much inspection. Nobody has a man page that is at all descriptive on "ld -A"'s use. If there's interest, I'll post them to the net. ----------------------------------------------------------------------- Greg Kemnitz | "I ran out of the room - I Postgres Chief Programmer | didn't want to be killed by a pile 278 Cory Hall, UCB | of VMS manuals" :-) (415) 642-7520 | kemnitz@postgres.berkeley.edu | --A friend at DEC Palo Alto in the Quake