On Dec 14, 2004, at 12:19 PM, Thomas DEGRIS wrote:
For a more general point of view, is MacOSX able to load multiple
libraries defining the same symbol ? If yes, do you know projects
(using libtools and automake) that use this method ?
...I'm having some problems with this, too: we use NSLinkModule() for
our bundle loading...when you use NSLINKMODULE_OPTION_PRIVATE,
multiple libraries defining the same (global) symbol can be loaded
because each module has it's own "namespace"...unfortunately, this
made it impossible (or rather, I haven't found a way yet) to call
functions from other loaded modules...
...when you don't use the OPTION_PRIVATE, the app will crash when a
module containing a duplicate symbol is loaded...this crash can be
avoided by using another flag,
NSLINKMODULE_OPTION_RETURN_ON_ERROR...but the module still doesn't
load...
...if it helps, this is what I'm using now:
ret = NSLinkModule( image, filename,
NSLINKMODULE_OPTION_BINDNOW |
NSLINKMODULE_OPTION_RETURN_ON_ERROR);
if (ret == NULL) {
int err;
const char *fname, *errt;
NSLinkEditErrors c;
NSLinkEditError(&c, &err, &fname, &errt);
post("link error %d %s %s", err, fname, errt);
return 0;
}
hth,
jamie