Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Naturally not, because CPython doesn't have a C++ FFI, which is a Python problem, not C++'s.


> because CPython doesn't have a C++ FFI

Does anything have a C++ FFI?


C++ for starters (obviously),.NET via C++/CLI, D, Swift is in the process of getting one.


> C++ for starters (obviously),.NET via C++/CLI

Of course C++ compilers are capable of generating C++ ABI code. They are not foreign function interfaces, they are native.

> D

They have some rather interesting commentary on the matter.

https://dlang.org/spec/cpp_interface.html.

> Being 100% compatible with C++ means more or less adding a fully functional C++ compiler front end to D.

> making a D compiler with such capability unimplementable

> the solutions have been:

> Support the COM interface (but that only works for Windows).

> Laboriously construct a C wrapper around the C++ code.

> Use an automated tool such as SWIG to construct a C wrapper.

> Reimplement the C++ code in the other language.

> Give up.

The pragmatic approach mentioned apparently consists of matching the D and C++ ABIs as much as possible just to make the problem tractable. Even after that impressive effort, the foreign interface is basic and incomplete. Special member functions like constructors and destructors are not supported, for instance. Notably, there is no exceptions support!

> Swift is in the process of getting one

Swift had to embed a literal C++ compiler inside itself in order to even make such a proposition viable.

https://faultlore.com/blah/c-isnt-a-language/

> Not even Swift has the stomach for this stuff.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: