Hacker News new | past | comments | ask | show | jobs | submit login

Sure, but if C++ had a stable ABI, then it would be more practical to directly wrap it. SWIG has some support for C++, after all, and there are a lot of C++ wrappers (e.g. ROOT, pybind11 and Boost.Python can all automagically generate python bindings for C++), but guess what happens when you mix libraries compiled with different std::basic_string ABIs...



It has two on Windows, they are called COM and UWP, although technically it is just one as UWP is an evolution from COM.

It has has one on IBM i and z/OS, as part of the language environments.


C++ has the stable Itanium ABI too, but that doesn't help when needing to bind with code that uses templates or preprocessor macros since those features are inherently language dependent. That's why re-wrapping the code with a C-compatible ABI is often a better approach. COM can also be accessed from C, by the way.


COM can be used by C if you are a masochist and feel like doing COM "Assembly" programming without some of the compiler hand holding, it got even worse with UWP that uses .NET metadata files, with support for a .NET like type system.

I guess when one is bored might try to re-implement ATL, WTL or UWP projections with C macros.




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

Search: