Re: resolving back-links with dlopen
Re: resolving back-links with dlopen
- Subject: Re: resolving back-links with dlopen
- From: Mattias Holm <email@hidden>
- Date: Wed, 25 Mar 2009 19:46:30 +0100
Hi,
Thanks, I managed to change the build to use -bundle instead, but it still doesn't resolve the back-links. Is the -bundle_loader flag mandatory? I would guess not since I have seen plugins that can be loaded by multiple applications (and I just grepped for the bundle_loader flag in the llvm sources which supply this functionality and it is not specified).
The compile commands for the plugin in question is:
/usr/bin/gcc -DUSE_SINGLE_FP_MATH -DENABLE_VECTORISE -DexamplePlugin_EXPORTS -undefined dynamic_lookup -std=gnu99 -O2 -faltivec -msse3 -fPIC -I/Users/holm/Projects/orbit/oo/include -I/Users/holm/Projects/orbit/oo/src -I/System/Library/Frameworks/Python.framework/Headers -I/opt/ode/0.10/include -I/Library/Frameworks/SDL_ttf.framework/Headers -I/Library/Frameworks/SDL.framework/Headers -I/Users/holm/Projects/orbit/oo/src/platform/macosx -o CMakeFiles/examplePlugin.dir/example-plugin.c.o -c /Users/holm/Projects/orbit/oo/src/plugins/example/example-plugin.c
Linking C shared module libexamplePlugin.so
/usr/bin/gcc -undefined dynamic_lookup -std=gnu99 -O2 -faltivec -msse3 -bundle -headerpad_max_install_names -o libexamplePlugin.so CMakeFiles/examplePlugin.dir/example-plugin.c.o
When executing my app:
dlopen(filename, RTLD_NOW|RTLD_LOCAL); still fails with:
oo: error: plugin load failed: dlopen(/Users/holm/Projects/orbit/oo/build/test/src/Open Orbit.app/Contents/Resources/plugins/libexamplePlugin.so, 6): Symbol not found: _omNewClass
Kind regards,
Mattias
On Tue, Mar 24, 2009 at 10:14 PM, Jean-Daniel Dupas
<email@hidden> wrote:
Le 24 mars 09 à 21:32, Mattias Holm a écrit :
Hi,
How do I load a .dylib file so that it resolves symbols in the executable loading it. I have built my lib with "-undefined dynamic_lookup", but I get errors like: dlopen(/Users/holm/Projects/orbit/oo/build/x86-darwin/src/Open Orbit Debug.app/Contents/Resources/plugins/libexamplePlugin.dylib, 6): Symbol not found: _omNewClass
Are there any special flags to pass when building the executable or the library so it finds the symbols from the executable file?
Code loaded at runtime should be a Bundle, not a Dynamic Library. You should build it using the gcc's -bundle_loader option.
http://developer.apple.com/documentation/developertools/conceptual/XcodeBuildSystem/500-Linking/bs_linking.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden