How to do an emscripten library?

I want to use a c library as haxe library.
I was able to compile it

<target id="NDLL" output="${name_prefix}sampleextension${name_extra}" tool="linker" toolid="${STD_MODULE_LINK}">
	<outdir name="../ndll/${BINDIR}" />
	<ext value=".ndll" unless="mobile"/>
        <flag value='-s' if="emscripten" />
	<flag value='WASM=1' if="emscripten" />

It builds a .ndll ( maybe an other extension is better ?)
But How to I load it . The usual cpp.lib.Load doesnt work as I don’t have access to cpp.

There’s information here but I have not tried doing this before:

https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html

You can compile using HXCPP’s build tool or using an ordinary make file or C build script with Emscripten

Referencing C++ using Haxe/C++ can be done using Haxe externs or using the Haxe CFFI system, but Emscripten called from JavaScript has it’s own approach for how you expose or call native functions

2 Likes