(I’m asking this here because looking at the docs, googling and searching the forum has not yet answered this for me - apologies if I’m overlooking something obvious)
I’m trying to build a cross-platform library with a C API meant to be consumed from as many other languages as possible. I’m looking into Haxe for this because the language looks very comfortable and powerful compared to the alternatives I’ve looked at already - combined with the possibility of wide portability via the C++ backend.
- First of all, is this even possible? Can a public C API be declared in Haxe, that will be available after C++ compilation? I know it’s possible to consume native libraries with Haxe, but I’m looking at the inverse situation - consuming Haxe via C. I need to be able to (for example) declare C-consumable callbacks in Haxe, allocate and share structs with the outside world, etc - all the usual behavior of a native C library.
And assuming the above is possible:
It’s not absolutely required, but it would be a major plus if I could even target older GCC compilers with the generated code - I’m hoping to get my code running on some legacy/exotic platforms like OS/2, Classic MacOS (9.2), and MorphOS/Amiga. (I believe all those have at least C++11 cross compilers available). But Win/Mac/Linux are the only hard requirements.
How often does the average, non-power-user run into compiler bugs? I previously started my work with another language that I had high hopes for, but so far I’ve hit two compiler bugs that have slowed down my progress and reduced my confidence in going forward. Now if I were more in love with that language I would be more determined to stick with it, but it lacks the high-level/functional goodness of Haxe and in retrospect was probably just too low level for what I’m trying to accomplish - so I’m eagerly looking around for something more pleasurable to use, and (if I’m lucky) more portable to exotic platforms.
cheers and thanks!