discuss-gnustep
[Top][All Lists]
Advanced

[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 21:11:41 +0100

On 13 Apr 2009, at 20:49, Thomas Kupper wrote:


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__)


Perfect! That's exactly what causes the error. In one file there are three calls to objc_msgSend. Now I tried to define the macro you mentioned. Unfortunately the # __VA_LIST__ part is not recognized and Google wasn't any help, and neither was a find ... -exec fgrep ....

Sounds like you have your compiler set to use some archaic dialect of C. Add -std=c99 to your CFLAGS.

On the other hand, if there are only three calls to objc_msgSend in only one file I could maybe just replace these three calls. But the objc_msg_lookup calls seems to be quite unusal.

You can do that too, just expand the macro, so:

objc_msgSend(obj, sel, args);

becomes:

objc_msg_lookup(obj, sel)(obj, sel, args);

(objc_msg_lookup() returns a pointer to the function that you call. objc_msgSend() does the lookup and the call as a single operation in the Mac runtime).

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]