We have encountered a problem where the dyld ends up using the incorrect dylib.
Here's the use case:
Plugin A (a bundle) depends on Dynamic Library A - referenced with "@loader_path". Plugin B (a bundle) depends on Dynamic Library B - referenced with "@loader_path".
Relevant File (binaries) layout is like this:
MyPluginA.bundle/Contents/MacOS/MyPluginA
[depends on @loader_path/../../../MyLibraryA.framework/MyLibrary]
MyLibraryA.framework/MyLibrary
MyPluginB.bundle/Contents/MacOS/MyPluginB
[depends on @loader_path/../../../MyLibraryB.framework/MyLibrary]
MyLibraryB.framework/MyLibrary
This scheme works fine on most machines.
But on some Macs, dyld tries to link MyPluginB with the library in MyLibraryA - which causes the plugin not to be loaded because it cannot find the required symbols in the library.
If we try to print dyld debug information, it shows that MyLibraryB is loaded and then unloaded, without showing any reason. And following that, the MyPluginB tries to look for MyLibraryB's symbols in MyLibraryA.
Can this be due to some kind of caching done by dyld?
Why is the @loader_path not being used to refer to the actual library being used?
All the exported symbols however are prepended with a version specific identifier.
Hmmm. Have you consider embedding the version number in the framework name? That seems like the easiest way out of this conundrum, in that the dynamic linker will consider them to be two completely different frameworks.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"