Weak linking vs. non-weak Linking
Weak linking vs. non-weak Linking
- Subject: Weak linking vs. non-weak Linking
- From: Andrew Kimpton <email@hidden>
- Date: Thu, 26 May 2005 16:50:16 -0700
I have a body of code built using Availability Macros and the
MACOSX_DEPLOYMENT_TARGET environment variables that uses some Tiger
features but needs to run on 10.3 (I'm using gestalt etc. to make
sure I don't call the new features on the old OS).
The project is built using some code collected into a static library
and then linking the static library against some 'loose' object
files. Running nm -mg on one of the object files in the static
library says :
nm -mg ZBitmap.o | grep CGL
(undefined) weak external _CGLayerCreateWithContext
(undefined) weak external _CGLayerGetContext
(I get the same result for using nm -mg on the static library)
Which looks just great. However when I run the same command against
the finished bundle the weak reference has disappeared :
nm -mg /Volumes/Source/main/builds/macos/BIAS\ Sqweez-5.vst/Contents/
MacOS/BIAS\ Sqweez-5 | grep CGL
(undefined) external _CGLayerCreateWithContext (from Carbon)
(undefined) external _CGLayerGetContext (from Carbon)
The weak reference has 'disappeared' and been replaced by a 'strong'
one. The only use of CGLayer is in the one object file (ZBitmap.o)
none of the other files compiled in call any CGLayer functions. So
somehow during my final link stage the reference is 'dropped'.
What could cause this ? I've tried a smaller example of linking my
library against a simpler object file and of course it works. Yet my
'broken case' isn't that complicated. I link approx 10 objects
against the library - I can't systematically reduce the broken case
by removing object files from the link line one by one to see if any
one is a culprit since they're interdependent.
Any thoughts or suggestions ?
Thanks
Andrew 8-)
P.S. I'm building with gcc 4.0/XCode 2.0
_______________________________________________
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