Re: Trying blocks
Re: Trying blocks
- Subject: Re: Trying blocks
- From: Greg Parker <email@hidden>
- Date: Fri, 30 Oct 2009 03:08:47 -0700
On Oct 30, 2009, at 1:40 AM, Jean-Daniel Dupas wrote:
Le 30 oct. 2009 à 07:33, Greg Parker a écrit :
On Oct 28, 2009, at 5:56 PM, Charlie Dickman wrote:
It compiles fine but the load fails with...
"__NSConcreteGlobalBlock", referenced from:
___block_holder_tmp_1.1207 in Controller.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Can anyone explain this and help me with what I'm not doing or not
doing right?
Blocks are only available on Mac OS X 10.6. Make sure your
project's SDK is set to 10.6 (or alternatively "Current Mac OS" if
you're compiling on a 10.6 machine). Blocks are currently
unsupported on Mac OS X 10.5 and iPhone OS.
_NSConcreteGlobalBlock comes from CoreFoundation. You could get
this error if you weren't liking to CoreFoundation, but presumably
you are linking to CoreFoundation by way of Cocoa.framework.
(Otherwise you'd have trouble with NSNumber and NSTextField too.)
I hate having to contradict you, but according to nm, all block
runtime symbols are in libSystem (although CoreFoundation probably
override them at runtime to use its own classes).
My mistake. The symbol _NSConcreteGlobalBlock is in libSystem, which
is what the linker above is looking for. The actual implementation of
the class _NSConcreteGlobalBlock is in CoreFoundation, which uses some
extra magic to tie the symbol and the class together at runtime. This
is all part of the twisty maze to make blocks work in CF-less C code,
while also acting like Objective-C objects in Objective-C code.
In any case, Charlie's linker error is unlikely to be a missing
framework, since his code would not have gotten far without libc and
CoreFoundation.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden