[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c interface to modules
From: |
Jonathan Wilson |
Subject: |
Re: c interface to modules |
Date: |
Fri, 17 Jun 2005 18:38:25 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031030 |
Whoops! I always forget and just hit reply, then the message doesn't go
to the list.
Ondrej Zajicek wrote:
Hello
I would like to export two sets (low-level and high-level interface)
of C functions to Scheme. I think it is a good idea to have each
interface in different module. What is a good way to define C
function in specific module? Should i just replace scm_c_define_gsubr
with combination of scm_c_make_gsubr and scm_c_module_define?
Hi Ondrej!
I would use SWIG if I were you. Very simple, fast, and easy. Does all
the drudge work of creating wrapper functions and all for you.
http://www.swig.org/ I have not used it for anything large scale, but
the smaller scale stuff I have done to test it out worked like a charm!
It will create a xxx_wrap.c file for every xxx.c or xxx.h file you feed
it, then you compile these wrapper files and link them into a shared
library along with the original code (and whatever libraries it needs to
link with). Then you can either just use (load-extension "xxx.so"
"SWIG_init") directly, or write a module in Scheme that loads the shared
lib whenever the module is loaded.
Best of luck!
Jon