[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Including C struct definitions
From: |
Joel Reymont |
Subject: |
Re: [Chicken-users] Including C struct definitions |
Date: |
Mon, 20 Dec 2004 12:28:18 +0000 |
> Nicolas Pelletier wrote:
>SWIG is used to provide access to C functions (a lib or custom code)
>to a higher-level language, isn't it ? I am trying to achieve the
>converse: calling from C into Scheme and exchanging structures in both
>directions.
Well, what SWIG does to register your structure and access methods is
something that you could do yourself, I think. But I see where you are
coming from. If the structure was registered "natively" with Chicken then
you won't need C access wrapper methods.
SWIG registers a bunch of C accessor functions that take the structure/
class pointer as an argument and get or set structure fields. Then it
wraps the whole thing in TinyCLOS code if you ask it to.
I think you could achieve what you are looking for by calling the SWIG-
generated accessors from your Scheme code, whether you call that code
from C or from Scheme shouldn't matter.
Joel
--
OpenPoker: The Linux of poker software
http://wagerlabs.com/forums
Tenerife: Canary Islands: Spain