On Oct 28, 2009, at 8: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?

I started a thread about this on the xcode-users list a day or two ago.

As far as I have been able to determine, you cannot include blocks- based code in a binary that runs on Leopard or older as well as on Snow Leopard. Testing for Leopard and older and branching around the blocks code does not solve the problem, because the linker still expects to see the blocks symbols at load time and they aren't there on Leopard and older. One solution, therefore, is to limit your application to Snow Leopard and give up on Leopard.

Apparently, one way to make your application work on older systems, as well, is to create two binaries using one of the techniques described in Technical Note TN2064: Ensuring Backwards Binary Compatibility - Weak Linking and Availability Macros on Mac OS X. A gross way to do this is to build one target for Snow Leopard and a separate target for Leopard and older, using availability macros so that the blocks-based code doesn't even compile into the Leopard-and-older binary. But then you have the problem of distributing two versions of your application, or writing a load-time helper that figures out which binary to load at run time. Alternatively, you could isolate the blocks-based calls in a small separate bundle in your application package and load it at run time if you're running on Snow Leopard.

Does anybody have any better solutions? Working code?


--

Bill Cheeseman
b...@cheeseman.name

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to