• 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 the same static library into two places
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: linking the same static library into two places


  • Subject: Re: linking the same static library into two places
  • From: Greg Parker <email@hidden>
  • Date: Thu, 7 Jul 2011 16:25:02 -0700

On Jul 7, 2011, at 4:03 PM, Jens Alfke wrote:
> On Jul 7, 2011, at 3:58 PM, Kenny Leung wrote:
>> Class XXXXX is implemented in both <your framework> and <Your app>. One of the two will be used. Which one is undefined.
>> The same happens with dynamically loaded bundles, etc...
>> Is there any good way around this?
>
> Not putting the classes into a static library. If you do, you end up with multiple copies of the classes, producing the warnings you’ve seen. If all copies of the classes are guaranteed to be built from the same code with the same build settings you’re probably OK, apart from the code bloat, but it still seems dangerous.

This is less safe than you might like. On iOS and 64-bit Mac, you may end up with both copies of the class in use simultaneously. That means two separate invocations of +initialize, two separate locks for @synchronized([MyClass class]), etc.

The simplest solution is to keep your utility classes in a static archive on iOS, but build it as a dylib for Mac OS.


--
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

  • Follow-Ups:
    • Re: linking the same static library into two places
      • From: Jens Alfke <email@hidden>
References: 
 >linking the same static library into two places (From: Kenny Leung <email@hidden>)
 >Re: linking the same static library into two places (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: App Delegate Methods
  • Next by Date: NSPopupbutton binding setter getter....
  • Previous by thread: Re: linking the same static library into two places
  • Next by thread: Re: linking the same static library into two places
  • Index(es):
    • Date
    • Thread