• 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: Weak linking in Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weak linking in Xcode


  • Subject: Re: Weak linking in Xcode
  • From: Chris Espinosa <email@hidden>
  • Date: Tue, 8 Mar 2005 11:53:53 -0800

On Mar 8, 2005, at 8:14 AM, Mark Thomas wrote:

How does one go about weak linking in Xcode, is that what the check box's
are for next to frameworks items ???.

No, that's not what the check boxes are for; the check boxes are target membership.


How you do weak linking with Xcode depends on what you're trying to do.

If you're simply trying to develop code on Panther so it will run on jaguar, use the AvailabilityMacros.h mechanism. That sets weak imports on a per-entry-point basis, and sets them all at once. Just select your target icon in the Groups and Files list, choose Get Info, go to the Build tab, make sure the list is showing "All Settings" (use the column header as a popup), and enter "Deployment" in the search bubble. It should show you "Mac OS X Deployment Target". Set that to the earliest version of Mac OS X you want to run on, and all[1] the right weak linking of system libraries and frameworks will be done for you. (This is all described better in TN2064).

If you want to weak-link your own library or framework, or a library or framework that doesn't support the AvailabilityMacros.h mechanism, then you can manually weak-import the whole library or framework. In your target inspector, find the Other Linker Flags entry and add one of the following flags:

-weak_framework foo.framework (for foo.framework)
-weak-lfoo (for libFoo.dylib)
-weak_library $(SRCROOT)/libs/mylibrary.dylib


Make sure to remove the library from the target (by unchecking that checkbox) so it's not linked twice, once strong and once weak.

Chris


[1] With certain exceptions. If you make OpenGL calls directly, you'll have to use OpenGL's versioning mechanism.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Weak linking in Xcode (From: Mark Thomas <email@hidden>)

  • Prev by Date: Re: Weak linking in Xcode
  • Next by Date: Getting the correct libraries
  • Previous by thread: Re: Weak linking in Xcode
  • Next by thread: Getting the correct libraries
  • Index(es):
    • Date
    • Thread