On 2013-04-15 19:56, John Colvin wrote:
Casting a function that returns void to a function that returns
something seems bound to cause trouble. While it may be allowed in C It
seems a bit of a leap to assume that it would work properly in D.
I don't know what to say, this is how you're supposed to call these
"objc_msgSend" functions. They part of the Objective-C runtime.
In C, if I call it like it's declare, returning void, I get a segfault:
NSRect foo (id screen)
{
NSRect rect;
((void (*)(NSRect*, id, SEL))objc_msgSend_stret)(&rect, screen,
sel_registerName("visibleFrame"));
return rect;
}
Don't ask me why it works like this.
--
/Jacob Carlborg