COMMUNITY

Build a .wasm Class using WebAssembly

haxe-js
haxe-cpp

(Paul) #1

There is a good description here for building a wasm using HAXE and WebAssembly

https://groups.google.com/forum/#!topic/haxelang/Pcm38LPFjW0

I want a class file similar to the one at this example on Github ( which does not use HAXE )


(Paul) #2

Anyone?

The problem is how to use the WebAssembly (Emscripten) ‘Embind’ to pass the variables.
Or how to make a public function with HAXE but not have it as a class, maybe.
If someone could steer me to some documentation on this topic I would greatly appreciate it.


(david mouton) #3

Hey, i tried do find a way to do it few month ago but i failed.


I hope you’ll have more success


(Paul) #4

Come to think, it may not be practical for HAXE to use a C++ class since issues such as memory management would require knowing how the class is used.


(Jérémy Faivre) #5

See there: https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management

It’s fine to expose a C++ class instance to JS as long as the JS side explicitly calls obj.delete() once it’s done with it.