[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] New "easy" FFI

From: felix
Subject: Re: [Chicken-users] New "easy" FFI
Date: Tue, 23 Sep 2003 00:06:10 +0200
User-agent: Opera7.11/Linux M2 build 406

On Mon, 22 Sep 2003 14:42:30 -0700, Miles Egan <address@hidden> wrote:

felix wrote:


Chicken got a new FFI interface (informally called the "easy" FFI).
It parses a subset of C and generates procedure and variable bindings
from declarations, like this:

#>! #include <math.h>

#define my_pi 3.14

int var = 99;
extern double sin(double);

(print (sin my_pi))
(print (var))
(var 123)
(print (var)) ; now 123

The parser does basic macro substitution, handles simple macros,
enums, typedefs, variable declarations and function prototypes.
Most preprocessor commands are implemented.

Pretty cool.

Why did you decide to treat C variables (var in the above) as scheme functions instead of scheme variables?

If you treat them as normal variables, then they're only available in
the current compilation unit - it's currently not possible to
"export" foreign variable bindings. But perhaps I should make
this optional? We could add optional processing instructions
after the "#>[!?]" to fine-tune the parsing process.
Any suggestions welcome!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]