Re: Weak linking failing on Intel?
Re: Weak linking failing on Intel?
- Subject: Re: Weak linking failing on Intel?
- From: George Warner <email@hidden>
- Date: Mon, 08 May 2006 09:00:44 -0700
- Thread-topic: Weak linking failing on Intel?
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.
;-)
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
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