On 3 December 2010 12:35, Neil Jerram <n...@ossau.uklinux.net> wrote:
> Andy Wingo <wi...@pobox.com> writes:
>
>> But I would like to mention the downside of the dynamic FFI
>> approach: with the static FFI you get typechecking by the C
>> compiler, but with the dynamic FFI you're on your own.
>
> Interesting point, thanks.
>
>> I suppose you could also use the C compiler to at least check that the
>> function type you declared is correct; if you want to do, at runtime,
>>
>>    (pointer->procedure int (dynamic-func "foo" (dynamic-link)) (list int32))
>>
>> you could at least make a compile-time check that
>>
>>     typedef int (*foo_type) (int32 bar);
>>     int main (...)
>>     { foo_type bar = foo; return 0; }
>>
>> doesn't produce any warnings with -Wall, or something.
>
> Hmm, that's almost as annoying as just writing the C code anyway.
>
> I guess what we want is to validate Scheme FFI code against the relevant
> C header file(s).  Hopefully something like SWIG or GCC modularisation
> might give us that in the future.
Would g-wrap work?  I remember g-wrap was written about 10 years ago,
back when swig didn't work so well, and certainly didn't work well with
guile.  But I had the impression that g-wrap went defunct. Not sure.

(what do I know? for all I know, maybe g-wrap morphed into ffi).

--linas

Reply via email to