[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Choosing between FFI approaches
From: |
Peter BARABAS |
Subject: |
[Chicken-users] Choosing between FFI approaches |
Date: |
Mon, 31 Oct 2005 22:32:11 +0100 |
Hello,
I've seen different kinds of methods in writing FFIs:
A.)
(define db:unknown 5)
In this case the Scheme variable gets a concrete value (which is the
value of the C variable).
B.)
(define-foreign-type dbtype int)
(define-foreign-variable db:unknown dbtype DB_UNKNOWN (->string DB_UNKNOWN))
(define db:unknown DB_UNKOWN)
Here the Scheme variable gets its value from the C variable DB_UNKNOWN
This approach has more abstraction (though it can be even more
abstract with a simple macro) and is more resistant to changes in the
C library. Does it have any disadvantages? This second method seems a
bit better for me.
Thank you.
--
'(Yours parenthetically),
peter barabas.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Chicken-users] Choosing between FFI approaches,
Peter BARABAS <=