> 
> 
> Also, adding the explicit & confuses the compiler - it then marks that code 
> as dead, stating it will never be executed. I’m not sure how it comes to that 
> conclusion exactly,
> 
> 

The reason it comes to that conclusion is because the header file declares that 
symbol as external but not weak. So the compiler believes the symbol must be 
defined at linktime/runtime and hence its address cannot be zero and hence that 
code can never be executed. 

unlike the linker which lets you link an entire framework weakly I don’t know 
of a version of #import which lets you import an entire framework weakly, 
effectively defining every symbol as weak. So there’s a mismatch between the 
header import and the library link. Would be nice to have an #importweak 
directive to match the weak link. 

You can redeclare the extern as __attribute__((weak)) after you import the 
header but stuffing it in a variable somehow seems easier. 
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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

This email sent to arch...@mail-archive.com

Reply via email to