Re: Linking to MLMediaSourcePhotosIdentifier
Re: Linking to MLMediaSourcePhotosIdentifier
- Subject: Re: Linking to MLMediaSourcePhotosIdentifier
- From: Roland King <email@hidden>
- Date: Thu, 23 Apr 2015 15:07:13 +0800
>
>
> 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 (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