Weak linking and NULL pointers
Weak linking and NULL pointers
- Subject: Weak linking and NULL pointers
- From: Vincent Le Normand <email@hidden>
- Date: Tue, 27 Dec 2005 19:12:47 +0100
Hi,
My framework is build in order to be compatible with :
On PPC : Mac OS X 10.2.8 -> Mac OS X 10.4.x
(Deployment target : 10.2 - SDK : current OS)
On Intel : Mac OS X 10.4.x
(Deployment target : 10.4 - SDK : 10.4u)
I use some Tiger/Panther only features. In order to run on multiple
platforms, I test function pointer:
ex:
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
if(FSCopyURLForVolume != NULL) // Not defined under 10.3
{
CFShow(CFStringCreateWithFormat(kCFAllocatorDefault,NULL,CFSTR("FSCopyURLForVolume
: %x"),FSCopyURLForVolume,NULL));
FSCopyURLForVolume(catalogInfo.volume,&urlpath);
}
#endif
It used to work until recently. Now, it crash under Mac OS X 10.2. In
fact, FSCopyURLForVolume is not NULL on this OS.
I've checked that availability macros are working writing this macro :
#if __BIG_ENDIAN__
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) &&
(__GNUC_MINOR__ >= 1))) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020)
#warning OK
#else
#error WEAK LINK DISABLED!!!
#endif
#endif
XCode displayed "Ok"
I've tried to compare build settings on working version and broken
versions, and i can't find where the problem is:
Project settings:
-----------------
ARCHS = $(NATIVE_ARCH) changed to ARCHS = ppc i386
MACOSX_DEPLOYMENT_TARGET = changed to MACOSX_DEPLOYMENT_TARGET = 10.2
GCC_GENERATE_DEBUGGING_SYMBOLS = YES changed to
GCC_GENERATE_DEBUGGING_SYMBOLS = NO
and this added
GCC_ENABLE_SYMBOL_SEPARATION = YES
GCC_AUTO_VECTORIZATION = NO
GCC_ENABLE_SSE3_EXTENSIONS = NO
GCC_FEEDBACK_DIRECTED_OPTIMIZATION = Off
GCC_SYMBOLS_PRIVATE_EXTERN = NO
GCC_INLINES_ARE_PRIVATE_EXTERN = NO
GCC_USE_NASM_FOR_ASM_FILETYPE = NO
GCC_OBJC_CALL_CXX_CDTORS = NO
GCC_THREADSAFE_STATICS = YES
GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES
GCC_WARN_ABOUT_MISSING_NEWLINE = NO
GCC_VERSION = 3.3
GCC_VERSION_i386 = 4.0
GCC_VERSION_ppc = 3.3
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk
Target settings:
--------------
ARCHS = $(NATIVE_ARCH) changed to ARCHS = ppc i386
OTHER_LDFLAGS = -lcrypto.0.9 -seg1addr 0x10000000 changed to
OTHER_LDFLAGS = -nodefaultlibs -lSystem -lstdc++ -lgcc -lcrypto.0.9
-seg1addr 0x10000000
and this added
GCC_ENABLE_SYMBOL_SEPARATION = YES
GCC_AUTO_VECTORIZATION = NO
GCC_ENABLE_SSE3_EXTENSIONS = NO
GCC_FEEDBACK_DIRECTED_OPTIMIZATION = Off
GCC_SYMBOLS_PRIVATE_EXTERN = NO
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
GCC_USE_NASM_FOR_ASM_FILETYPE = NO
GCC_OBJC_CALL_CXX_CDTORS = NO
GCC_THREADSAFE_STATICS = YES
GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES
GCC_WARN_ABOUT_MISSING_NEWLINE = NO
GCC_VERSION = 3.3
GCC_VERSION_i386 = 4.0
GCC_VERSION_ppc = 3.3
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk
Does anybody have an idea?
Thanks,
Vincent
_______________________________________________
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