Re: Weak link
Re: Weak link
- Subject: Re: Weak link
- From: Chris Hanson <email@hidden>
- Date: Tue, 23 Oct 2007 17:46:54 -0700
On Oct 23, 2007, at 1:45 PM, Chen Wang wrote:
I'm wondering how you guys work with "weak link" readily in XCode? I
recently did a test in XCode 2.4.1, my Cocoa project is targeted to
10.2, therefore GetEventMonitorTarget() is not available because
this API was introduced since 10.3. So, I tried weak link as
suggested by Apple's document ( XCode > Framework Programming Guide
> Freameworks and Weak Linking ), but I always received "Undefined
symbols: _GetEventMonitorTarget" error from XCode. Did I miss
something that is basic but critical? Here is my code in short:
extern EventTargetRef GetEventMonitorTarget( void )
__attribute__((weak_import));
...
if ( GetEventMonitorTarget != NULL )
{
EventTargetRef refFoo = GetEventMonitorTarget( );
}
...
And [MACOSX_DEPLOYMENT_TARGET] was already set to Mac OS X 10.2 in
XCode.
You shouldn't have to do quite so much work. As long as you have
MACOSX_DEPLOYMENT_TARGET=10.2 you should be able to just use
GetEventMonitorTarget from the 10.3.9 or 10.4u SDK without re-
declaring it. The header file containing its declaration should
already specify that it was introduced in 10.3, and therefore
automatically mark it as weakly-imported if you're targeting an
earlier operating system.
Remember also that build settings defined at the target level override
build settings defined at the project level, and that a defined build
setting's name is boldface. Check your target and project settings in
each of your configurations to ensure that one at the target level
isn't empty instead of undefined, or that one isn't set incorrectly at
the target level and overriding a correct setting at the project level.
If you share your customized build settings with this list, we should
be able to ensure they're set correctly. You can copy and paste build
settings from the build settings outline into a text editor like the
Mail message window (and do the opposite as well).
-- Chris
_______________________________________________
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 link (From: "Chen Wang" <email@hidden>) |