[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Yet another ffi...
From: |
felix winkelmann |
Subject: |
[Chicken-users] Yet another ffi... |
Date: |
Sun, 27 Feb 2005 09:51:40 +0100 |
A new egg providing another way to interface to foreign libraries is
available at
http://www.call-with-current-continuation.org/eggs/lazy-ffi.html
It looks like this:
~"libc.so.6"
(~printf "%d -> %g, ok: %s\n" 123 45.67 "hello")
(~sleep 1)
~"libm.so.6"
(~sin 33.4 return: double:) ==> 0.915809602890819
(~tolower #\A return: char:) ==> #\a
(let* ([box (f64vector 0)]
[r (~modf 123.456 f64vector: box return: double:)] )
(list r box) ) ==> (0.456 #f64(123.0))
Pros: no declarations needed, handles variadic C functions.
Cons: needs libfffi/dlopen (not particularly portable), only absolutely minimal
safety checks.
cheers,
felix
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Chicken-users] Yet another ffi...,
felix winkelmann <=