Weak symbol link on Mac OS X
Currently I encountered a weak link issue on Mac OS X 10.6.7 with Xcode 4.0.2. robin@chameleon:/tmp/o$ gcc --version i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) As the document http://developer.apple.com/library/mac/#technotes/tn2064/_index.html said, we can use gcc attribute ((weak_import)) for weak link symbol. However, the following sample code always throw compile error. As the following: weak.c : #include <stdlib.h> #include <stdio.h> extern int SayHello() __attribute__((weak)); int main() { int result; if (SayHello!=NULL) { printf("SayHello is present!\n");