• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Linking to MLMediaSourcePhotosIdentifier
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Linking to MLMediaSourcePhotosIdentifier (From: Graham Cox <email@hidden>)
 >Re: Linking to MLMediaSourcePhotosIdentifier (From: Roland King <email@hidden>)
 >Re: Linking to MLMediaSourcePhotosIdentifier (From: Graham Cox <email@hidden>)
 >Re: Linking to MLMediaSourcePhotosIdentifier (From: Roland King <email@hidden>)
 >Re: Linking to MLMediaSourcePhotosIdentifier (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Linking to MLMediaSourcePhotosIdentifier
  • Next by Date: Re: Crash at iOS App Startup - What Could Have Gone Wrong?
  • Previous by thread: Re: Linking to MLMediaSourcePhotosIdentifier
  • Next by thread: Re: Linking to MLMediaSourcePhotosIdentifier
  • Index(es):
    • Date
    • Thread