• 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 failing on Intel?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weak linking failing on Intel?


  • Subject: Re: Weak linking failing on Intel?
  • From: Rosyna <email@hidden>
  • Date: Mon, 8 May 2006 09:13:53 -0700

Sadly this is Mac OS X only. However, I was able to work around it without having to redclare everything to work around, what appears to me to be, a GCC bug (thinking it knows more than the linker).

I just created a global dummy var called stupidGCC.

		if ((stupidGCC=VersionCheck)!=NULL)
		{

This forces GCC to be submissive to my will.


Ack, at 5/8/06, George Warner said:

On Sat, 6 May 2006 12:18:51 -0700, Rosyna <email@hidden> wrote:

 Err, forgot something important.

 Specifically, I'm using the instructions for weak linking a framework
 at

http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts
/WeakLinking.html#//apple_ref/doc/uid/20002378-107026

Since I don't own this particular framework, I'd have to redeclare every single function I use in a brand new header with the weak attribute. For somethings I use, this is 20+ symbols.

Just an FYI: If the statement declarations in the header for this framework include any type of macro you may be able to add the weak attribute to that macro:

Let's say the header includes this macro declaration:

#ifndef WIN_API
#if defined(_WIN32)
#define WIN_API __declspec(dllimport)
#else
#define WIN_API
#endif

And all the function declarations use the macro:

extern int WIN_API TheFrameworkAPI( void );

So add this to your pre-compiled header (assuming you don't use it when
building for Windows ;-):

#define WIN_API __attribute__((weak_import))
#include "the_framework_header.h"

Now all the API's that use the macro will have the weak_import attribute.
;-)

--


Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People

It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
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: 
 >Re: Weak linking failing on Intel? (From: George Warner <email@hidden>)

  • Prev by Date: Re: Weak linking failing on Intel?
  • Next by Date: re: Carbon framework - Public headers
  • Previous by thread: Re: Weak linking failing on Intel?
  • Next by thread: [Q] Xcode find/replace or insert Text macro
  • Index(es):
    • Date
    • Thread