Its completely different approach. SWIG is a tool designed to create
bindings, for which you provide an interface descripitions, which usually
includes your C/C++ headers, and you provide some SWIG specific directives
for improving the generated bindings.
It produces C side module and a language specific module. The C side is
required, since some C stuff can only be detected by an actual C compiler.
In these matter, maybe TalkFFI is better, because is based in an actual
compiler(clang), but maybe you lose some bindings fine tuning.

The problem is when you add C++ to the mix. In C++ there's not a standard
defined ABI, so a module made in one C++ compiler is almost for sure going
to be incompatible with a module made by another C++ compiler. For making
bindings to a C++ module, you have to first make C bindings to that module,
compile those bindings with the same compiler that was used for the
original module and then you can start making NativeBoost bindings. This is
the only portable way for C++.

For example, gcc and Microsoft Visual C++ compilers are completely
incompatible for C++, but for C they can interact. Clang is apparently
designed to use the same ABI as gcc, so maybe it could be used in Linux,
Mac but not for a closed source library in Window.

What SWIG does is generating the C bindings and Smalltalk code that calls
the C bindings ready to be filed in. In addition, you can add extra code to
the bindings to make things that hard to do using directly NativeBoost but
can be easy to do with an intermediate function in C, for example messing
with some unions and things that required lot of pointer arithmetic, that
could be used maybe for a bad written library that some project needs.

P.S I have yet to make an example. When I add some documentation, which is
required to be able to integrate into the main SWIG distribution, I will
post a new message to the list.

Greetings
Ronie Salgado


2014/1/23 Stefan Marr <smallt...@stefan-marr.de>

> Hi Ronie:
>
>
> On 22 Jan 2014, at 21:25, Ronie Salgado <ronies...@gmail.com> wrote:
>
> > I started working on extending SWIG to generate bindings for NativeBoost
> FFI, using as a reference the C# binding generator. I am committing my work
> on this into https://github.com/ronsaldo/swig/ .
>
> Just out of curiosity, how does it compare to TalkFFI?
>  (
> http://lists.gforge.inria.fr/pipermail/pharo-project/2013-January/072847.html,
> http://vimeo.com/63472765)
>
> Best regards
> Stefan
>
>
>
> --
> Stefan Marr
> INRIA Lille - Nord Europe
> http://stefan-marr.de/research/
>
>
>
>
>

Reply via email to