Re: Dynamic loading of a third party .dylib
Re: Dynamic loading of a third party .dylib
- Subject: Re: Dynamic loading of a third party .dylib
- From: Greg Parker <email@hidden>
- Date: Mon, 9 Aug 2010 13:13:07 -0700
On Aug 7, 2010, at 3:44 PM, email@hidden wrote:
> 1. In Xcode I link to my dylib and mark it as weak.
> 2. In my app I call dlopen() before accessing any of the library symbols.
>
> But the symbol doesn't get resolved.
>
> The crash log reports:
>
> Dyld Error Message:
> can't resolve symbol _G__main in /Nuzzle/And/Scratch/MacOS/Contents/boo because dependent dylib #5 could not be loaded
>
> Do I have to manually call dlsym() or am I missing a weak attribute somewhere.
You need to call dlsym(). A later dlopen() cannot fix a missing weak symbol. A weak symbol reference only gets one chance to resolve. If the symbol is not present at load time, then the reference is set to NULL and won't change after that.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden