[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Announce - SWIG-1.3.30
- From: Sam Roberts <sroberts@...>
- Date: Fri, 17 Nov 2006 14:02:27 -0800
On Fri, Nov 17, 2006 at 11:09:39AM -0800, Don Hopkins wrote:
> it doesn't require that your code be written in C++, and it doesn't
YMMV. I tried to use swig to bind a C library into ruby for a few days,
and came away pretty frustrated.
The impression I got was that swig was very good at binding OO C++ into
OO languages (I guess because c++ has enough compiler keywords that make
it clear what is an object, and what the ctor/dtor is, etc.), but what I
had was fairly typical "OO in C" libraries:
typdef struct Foo Foo;
int foo_new(Foo** foo, int arg);
int foo_use(Foo* foo, const char*in, size_t in_sz, char* out, size_t* out_sz);
# non-zero return is an error
void foo_destroy(Foo** foo);
I thought it would be easy to bind, because the library, while having a
lot of APIs, had a very, very consistent set of calling conventions, but
I had trouble finding documentation on this. There was lots of doc
coverage of how to do cool things with C++ and templates, but the simple
case of C libraries was surprisingly under discussed.
Anyhow, I think I could do great things with swig if I knew it well, but
the learning curve was pretty steep at the time. I hand-coded the
bindings.
Sam