dynamic linking C code with ld link editor

Greg Kemnitz kemnitz at gaia.berkeley.edu
Thu Feb 14 07:04:48 AEST 1991


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 at postgres.berkeley.edu |      --A friend at DEC Palo Alto in the Quake



More information about the Comp.unix.wizards mailing list