[plt-scheme] Problem with FFI functions returning pointers to 'C' functions

From: Tim Brown (tim.brown at cityc.co.uk)
Date: Thu Sep 13 06:13:05 EDT 2007

Eli.

Thank you very much for this.

On 12/09/07 15:57, Eli Barzilay wrote:
> But in the meanwhile, here is a solution that works for now:

> [...]

> * Using this:
> 
>     (define c-signal
>       (get-ffi-obj "signal" #f
>         (_cprocedure* (list _int (_cprocedure* (list _int) _void))
>                       (_cprocedure* (list _int) _void))))
> 
> 
> On Sep 12, Tim Brown wrote:
>> Anyway, I am returning a _fpointer, and only casting it (with ptr-set)
>> to an (_fun _int -> _void) if it is (not #f).
> 
> I'm pretty sure that doing such a cast will not work.

It seemed to work for me. But only in a trivial test.
And I had the suspicion I was chancing my luck!

Tim

-- 
Tim Brown <tim.brown at cityc.co.uk>  | City Computing Limited            |
T: +44 20 8770 2110                | City House, Sutton Park Road      |
F: +44 20 8770 2130                | Sutton, Surrey, SM1 2AE, GB       |
-----------------------------------------------------------------------|
BEAUTY:  What's in your eye when you have a bee in your hand           |
-----------------------------------------------------------------------'
City Computing Limited registered in London No. 1767817.
Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
VAT number 372 8290 34.


Posted on the users mailing list.