[plt-scheme] ffi help

From: Mike Miller (mike at nec-labs.com)
Date: Tue Jul 26 19:02:36 EDT 2005

Sorry to ask such a simple question.

I have a safe cvector of double values (or equivalently, an srfi-4  
f64vector).  I'd like to pass it into the external C function:

    void cfunc (int alen, double *a);

and be able to modify values of a inside the C routine, and have the  
changes appear back on the Scheme side after returning from the  
function.

I tried to do the following, to no avail:

   (define cfunc (get-ffi-obj "cfunc" "myclib"
                              (_fun _int _cvector -> _void)))

I also tried _f64vector instead of _cvector.  The error message I get  
is:

   procedure application: expected procedure, given: #f; arguments  
were: #<struct:fun-syntax> #<syntax:54:36>

Earlier posters verified a bug exists with the foreign module.

However, can anyone suggest a workaround?

I'm using 299.100 (and have tried 299.108 too) under Mac OS X.

Thanks,
Mike Miller



Posted on the users mailing list.