• 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: Link issue??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Link issue??


  • Subject: Re: Link issue??
  • From: Alastair Houghton <email@hidden>
  • Date: Tue, 28 Jul 2009 10:13:10 +0100

On 27 Jul 2009, at 20:56, Fritz Anderson wrote:

On 27 Jul 2009, at 1:44 PM, Michael de Haan wrote:

The compiler does not know, from #import <CoreData/CoreData.h>, that Core Data is a framework (it doesn't know about frameworks at all),

Well that's not entirely true; it---at least in the preprocessor--- *does* know about frameworks, and it also knows that Core Data is a framework (it has to in order to find CoreData.h, since there is no folder "CoreData" containing such a header file). It's just that #import and #include *only* pull in the header file; they don't also cause an application to link against the framework whose header was imported.


and there are several Core Data frameworks on your development machine, depending on the SDK or platform you're using. Even if the compiler had a way to communicate it to the linker, it would not be enough information to identify the framework.

One could imagine a suite of development tools that inferred the existence and location of a library from the presence of an #import somewhere in your source, but that isn't Xcode, and it isn't the GCC tool chain.

IIRC MSVC has a feature whereby you can use a pragma to ask the compiler to insert an instruction into the object to tell the linker to link with a particular library. I'm sure I remember seeing similar features in other C compilers as well.


In practice, such stealth linking is a bad idea for C-based languages because the expected behaviour is that #import/#include just does text substitution using the pre-processor.

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________
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: 
 >Link issue?? (From: Michael de Haan <email@hidden>)
 >Re: Link issue?? (From: Nick Zitzmann <email@hidden>)
 >Re: Link issue?? (From: Michael de Haan <email@hidden>)
 >Re: Link issue?? (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: C++ exception breakpoint failure
  • Next by Date: Re: C++ exception breakpoint failure
  • Previous by thread: Re: Link issue??
  • Next by thread: Re: Using Snow Leopard for development (was: NSString Retain Count of 2147483647)
  • Index(es):
    • Date
    • Thread