simple display (from: GUI library for D)

Jacob Carlborg doob at me.com
Mon Apr 11 05:43:29 PDT 2011


On 2011-04-11 11:41, KennyTM~ wrote:
> On Apr 11, 11 15:43, Jacob Carlborg wrote:
>> When using objc_msgSend and friends you need to cast the function to the
>> right signature, to the same signature as the method you're calling via
>> objc_msgSend, before calling it. See
>> http://www.dsource.org/projects/dstep/browser/dstep/objc/message.d#L74
>>
>> If you start passing floats to objc_msgSend you'll soon notice that you
>> get some weird behaviors if you don't cast it to the right signature.
>>
>> You also need to use different versions of objc_msgSend depending on
>> what the return type is and on that platform you're on. If you're
>> returning a struct or an floating point number of some kind you need to
>> use a different version of objc_msgSend. You can have a look at:
>> http://www.dsource.org/projects/dstep/browser/dstep/objc/bridge/Bridge.d#L779
>>
>> . Also look the function being called:
>> http://www.dsource.org/projects/dstep/browser/dstep/objc/message.d
>
> Yes I know. Since all objc_msgSend used only operate on integers and
> pointers and structs and doubles, and they only return pointers or void,
> I didn't bother to cast them.

Fair point. But since we are talking about GUI libraries, images and 
drawing 2D graphics it's most likely floating point numbers will be used 
eventually, at least somewhere.

> Anyway, those calls are now updated to handled it properly, please check
> https://github.com/kennytm/simpledisplay.d/commit/18b6.

Ok.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list