[Openmcl-devel] reloading/unloading shared libraries?

Gary Byers gb at clozure.com
Mon Feb 9 14:17:46 PST 2004

On Mon, 9 Feb 2004, Brian Mastenbrook wrote:

> On Feb 9, 2004, at 2:21 PM, Gary Byers wrote:
> > The OS is more than happy to let you open a bundle multiple times.
> > It's so happy, in fact, that it allows you to have multiple instances
> > of the same library loaded at the same time, and it's generally hard
> > to predict in which of a set of loaded bundles an external symbol
> > will be found (I -think- that it's the first open library to have
> > been loaded, but I don't know that one can reliably count on this.)
> > It's hard in general for the lisp to keep track of which bundles
> > have already been loaded, since the OS doesn't always tell it
> > where the bundle was found.
> Does OpenMCL keep track of this on its end, so that it can choose which
> bundle to actually get the symbol from? In SBCL I'm using
> NSLookupSymbolInImage so that symbols always dereference to the wanted
> bundle.

It uses #__dyld_lookup_and_bind.

The disadvantage is that you don't get to specify which shared object
to load a symbol from; the advantage is that (a) you don't have to
specify which shared object to load a symbol from and (b) symbols
resolve the same way that they do for other dynamic linker clients
(i.e., if there are multiple definitions of #_malloc present, you
probably want the same one that everyone else got ...)

I can certainly imagine cases where one might -want- to override
#__dyld_lookup_and_bind's default behavior (I suspect that not every
case is like #_malloc, or at least that the consequences of having
two versions of many foreign symbols "in use" at the same time are
less severe).

> --
> Brian Mastenbrook
> bmastenb at cs.indiana.edu
> http://cs.indiana.edu/~bmastenb/
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

More information about the Openmcl-devel mailing list