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

There are tools to create bindings for C and C++, like SWIG you can see some examples in [0], e.g. the wxWidgets bindings for Python. AFAIK for Gtk bindings can be generated using gobject introspection handling most (if not all) of the mundane bits.

[0] http://www.swig.org/projects.html




I'm aware and have used SWIG. It is amazing, but a) it doesn't support all languages b) it still takes a lot of work to create C++ bindings. This is primarily due to the complexity of C++ APIs vs. relative simplicity of a C-based API as another poster commented, not any shortcoming of SWIG.

So yes, there are tools, my point is it is still much easier to wrap a C based API because you can often just use your language FFI, not an external toolset.


Sure, i do not disagree that wrapping C++ is harder than C, but my point was that the language is widespread and popular enough to actually have tools that assist such wrappings, unlike other languages, so even if all else were equal you are more likely to see a C or C++ library be wrapped than -say- a Free Pascal library (which can create DLL/so/etc that are 100% compatible with C and thus wrappable).




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: