C++ CFFI interaction
Pascal Bourguignon
pjb at informatimago.com
Sat Jun 11 10:22:30 UTC 2016
> Le 6 juin 2016 à 09:33, Ralf Mattes <rm at seid-online.de> a écrit :
>
> 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++:
It would be possible. Name mangling only means that the actual name of the functions are not what is witten is the program source. Unfortunately, the actual mangling is C++ compiler dependant, so you would have to reproduce the algorithm for each C++compiler you would want to support. Alternatively, you can just look up the symbols in the libraries themselves, but this would be more a manual approach to match the right mangled symbol with the right polymorphic function, if you don't know the mangling rule.
On the other hand, AFAIK, clang implements the same mangling as gcc, so implementing it for your ffi would already cover 99% of the cases.
--
__Pascal Bourguignon__
More information about the pro
mailing list