• 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: lib*.a restriction...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lib*.a restriction...


  • Subject: Re: lib*.a restriction...
  • From: Andrew Pontious <email@hidden>
  • Date: Wed, 24 Aug 2005 17:47:54 -0700

On Aug 24, 2005, at 2:50 PM, Peter Lau wrote:

while reading the "Porting CodeWarrior Projects to Xcode", it has a box which says:

"Important: Static libraries currently will not be linked in Xcode unless they are named according to the format lib*.a. That is, they must start with lib and have the extension .a.".

That does not seem to be our experience with XCode 2.1, has the restriction been removed?

It's a little complicated. ;-)

If you look at the ld (linker) manpage, you can see this:

-lx    This  option  is  an abbreviation for the library name `libx.a',
              where x is a string.  If -dynamic is specified the  abbreviation
              for  the  library  name is first search as `libx.dylib' and then
              `libx.a' is searched for.  ld searches for  libraries  first  in
              any  directories specified with -L options, then in the standard
              directories /lib, /usr/lib, and /usr/local/lib

Let's say you include a library in your Xcode project, and you add it to the "Link Binaries With Libraries" build phase of one of your targets.

If the library's name is of the form 'libXXX.a' or 'libXXX.dylib', we pass the library name to the linker in the format -lXXX, so that you get the flexibility of the search behavior described above.

if the library *doesn't* have that naming convention, we pass in the full path to the library to the linker. So you don't get the same flexibility - linking will only work if that library is really at exactly the path it was at when you added it to Xcode - but the linker can find the library and do the right thing with it, regardless of the library's name.

Hope that helps,

-- Andrew Pontious
 _______________________________________________
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

  • Follow-Ups:
    • Re: lib*.a restriction...
      • From: Peter Lau <email@hidden>
References: 
 >lib*.a restriction... (From: Peter Lau <email@hidden>)

  • Prev by Date: Re: Wrap library in namespace?
  • Next by Date: XCode 2.1 will not run.
  • Previous by thread: lib*.a restriction...
  • Next by thread: Re: lib*.a restriction...
  • Index(es):
    • Date
    • Thread