help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Re: C Callbacks


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Re: C Callbacks
Date: Tue, 20 May 2008 13:51:13 +0200
User-agent: Thunderbird 2.0.0.14 (Macintosh/20080421)

.
callback := ExternalCallback
block: [ :lplf :lptm :dwType :lpData | operation value: lplf value: lptm value: dwType ]
      argumentTypes: 'LOGFONT* lpvoid dword dword'

I see -- the most similar thing to this one is provided by msgSendf. You would have to rewrite msgSendf as a function that follows the libffi closure API, and then pass it to the ffi_prep_closure together with an ffi_cif (there is already code to construct ffi_cif from a CFunctionDescriptor). See for example http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/ffi_prep_closure.3.html (the main difference is that, in the example, foo_closure does not look at its CIF argument).

Due to the fact that I need to create callbacks dynamically based on third party data I get (dynamically as well :-( ) I think there is no way around libffi. Maybe I can reuse the existing parameter stuff around #cCall: for inbound calls.

Yes, most of it is written for libffi so it can be recycled for this setting too. It's in cint.c.

Paolo




reply via email to

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