Short preamble about emscripten
emscripten would certainly help a lot - I tried it and indeed, everything is much simpler in the C++ world, but I’d like, as a challenge, & in order to build a wasm with a small footprint, & in order to control and understand more of what’s happening in the code/libs, to keep using Clang++, at least for now. So I decided not to use emscripten nor its libs.
I'm developing a small wasm32 project with Clang, it's more of a PoC for the time being, but that's very interesting, crossing the worlds of assembly and JS in a browser. Creation of a memory space in JS, sharing with the wasm, exchange data, customization of the wasm for stack size, stack first, memory handling... all went well, better than expected. Then I did a tiny C++ program using a tiny class
Node *node = new Node(position);
And wasm-ld
always complained about the lack of the “new” operator (to ensure this is the problem, I implemented my own “new” operator and that worked).
When I built llvm 18 from source, I noticed it searched (and finds) g++ (12/11 & 10 on my Ubuntu 22.03). Then I read somewhere that it actually uses the g++ libs(?). And since (it seems) g++ does not have C++ libs for wasm32, there is no way to “bypass” emscripten?
I don’t need exceptions and all the bells and whistles of C++, just the basics, “new”, “delete” and “cstdlib” headers and associated wasm-libs.
Actually my question, being a beginner, would merely be a confirmation of the above (no c++ wasm std libs in clang, nor in g++)? And if, hopefully, I happen to be wrong, please let me know how to build it for wasm32.