[plt-scheme] C++ Bindings using FFI

From: Igor Mikhailov (imikhailov at jnetx.ru)
Date: Wed May 10 12:05:35 EDT 2006

Paulo J. Matos escribió:
> Hi all,
> 
> Does anyone have any experience with generating bindings for libraries
> in OO-based C++?
> Is there an easy way to achieve this using Eli's FFI?
> 

Hi.

I had been using PLT Scheme's FFI and SWIG recently (separately one from 
another).

My task was to make an interface to small C++ library. I tried to use 
SWIG (it declares mzscheme support), but it has not worked out of the 
box for me. Then I manually wrote C wrapper for this library and 
manually wrote FFI interface description for the wrapper. Since that it 
has been working ok.

So, I think it is very helpful to have some tools to:
1. generate C wrapper for C++ interface using C++ header files.
2. generate FFI description for C interface using C header files.

I think it is reasonable to use SWIG - this is the tool right for these 
tasks - it has C and C++ parser, code generation framework and build-in 
ability to create C wrappers for C++ libraries.
Actually I was going to create such SWIG extension (I have even read in 
docs how to extend SWIG), but I have postponed this project for a while.


Also I have read in FFI's documentation, that there is ongoing work to 
write C parser for FFI. How it is going?

Igor.


Posted on the users mailing list.