[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: linking tool to use a framework : obj_send_msg error
From: |
David Chisnall |
Subject: |
Re: linking tool to use a framework : obj_send_msg error |
Date: |
Mon, 13 Apr 2009 12:43:15 +0100 |
On 12 Apr 2009, at 22:23, Thomas Kupper wrote:
Next I created a very minimalistic tool application which uses the
log4cocoa framework (of course I first installed it into the USER
domain). Now the linker throws an error message
"Linking tool ocHello ..."
"/home/thomas/GNUstep/Library/Libraries/liblog4cocoa.so: undefined
reference to 'objc_msgSend'".
"collect2: ld returned 1 exit status"
There is probably some 'optimisation' in the framework calling the
Apple runtime message send function directly (the quotes because
anything doing I/O like this is likely to gain an imperceptible
performance increase from calling the runtime functions directly
rather than using -methodForSelector:). Try grepping the source code
for objc_msgSend() and, in files that contain it, add this macro:
#define objc_msgSend(theReceiver, theSelector, ...) \
objc_msg_lookup(theReceiver, theSelector)(theReceiver, theSelector,
## __VA_LIST__)
How can that happen if the framework compiles/links fine. And the
tool compiles/links fine, too without using the framework.
Libraries are not checked for unresolved symbols when they are
linked. This allows you to create a library which depends on a
function that is declared in an application, providing a fast
(although very fragile, unsafe, and stupid) way of implementing
callbacks, but is mainly intended for static libraries which are
intended to be combined with others to provide a full implementation
of an API.
Can someone give me a hint how I can track down that error?
Look for objc_msgSend() in the log4cocoa framework source.
David