On Aug 7, 2010, at 3:44 PM, [email protected] 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 protected]     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to