C++ CFFI interaction
Ralf Mattes
rm at seid-online.de
Mon Jun 6 07:33:04 UTC 2016
On Sun, Jun 05, 2016 at 03:39:38PM -0700, Drew C wrote:
> I use cl-autowrap[1], which uses c2ffi[2] to create "definitions from C,
> C++, and Objective C headers for use with foreign function call interfaces".
>
> it uses CFFI-SYS, and I have only tested it out using C++ libs,
That's interesting, coul you elaborate a bit?
I was under the impression that such a straight ffi would be impossible (thanks to
C++'s name mangling). I on't see how c2ffi can cope with the following valid C++:
|----------------[ file: foo.h ]-------------------------------------------
int do_something(int input);
int do_something(char *input);
|--------------------------------------------------------------------------
And, indeed, my fresh checkout of c2ffi complaints bitterly :-/
The next problem would be the fact that the output of C++ compilers still isn't really
ABI-compatible.
> but it
> should work for most things most of the time. I am not sure if it is the
> best way, but, I did it my way[3].
The only real working wrapper for C++ libs (Qt4) are the wrappers based on KDE projects
smoke based binings. But those need "auto"[1]-generated wrapper libraries ...
So, to wrap your own libraries you'd need to generate smoke wrappers. Doable but not
simple.
HTH Ralf Mattes
[1] For a very broad definition of "auto"
>
> Cheers,
>
> Drew Crampsie
>
> [1] https://github.com/rpav/cl-autowrap
> [2] https://github.com/rpav/c2ffi
> [3] https://www.youtube.com/watch?v=WIXg9KUiy00
>
> On Sun, Jun 5, 2016 at 1:56 PM, Antoniotti Marco <
> antoniotti.marco at disco.unimib.it> wrote:
>
> > Hi
> >
> > I just spent a bit of time looking for this, i.e., how to get a CFFI for a
> > C++ library, but at this point I am not so sure about the best way to go
> > about this.
> >
> > What is the wisdom of the list on the subject?
> >
> > Thanks
> >
> > Marco
> >
> >
> >
> >
> > --
> > Marco Antoniotti, Associate Professor tel. +39 - 02
> > 64 48 79 01
> > DISCo, Università Milano Bicocca U14 2043
> > http://bimib.disco.unimib.it
> > Viale Sarca 336
> > I-20126 Milan (MI) ITALY
> >
> > Please check: http://cdac.lakecomoschool.org
> >
> > Please note that I am not checking my Spam-box anymore.
> > Please do not forward this email without asking me first.
> >
> >
> >
> >
> >
> >
More information about the pro
mailing list