Compliling multiple Haxe code files to Emscripten via javascript

You are probably looking for something like this:

@:buildXml('<target id="haxe" tool="linker" toolid="exe"><lib name="user32.lib" /></target>')

If you are using an external build.xml then put that there in the appropriate section.

WOW!!

Could it be that simple?

Thanks ianharrigan. I’ll check it out tonight. Would I need to give the full path name to user32.lib?

Are more details examples, tutorials on @buildXml?

this is probably good for reference: C++ - Haxe - The Cross-platform Toolkit (all sections)

I dont really know much about trying to compile to hxcpp to wasm, but just looking here: Library Documentation Entry - C-API USER32.DLL (Windows) - Function List makes me think that you shouldnt need user32.lib, i mean, they are specific windows functions, that seem to be for UI stuff - but again i have NO experience with what you are trying to do, so maybe it is valid… no idea.

I agreed. I don’t know why the linker need user32.lib. I’m just compling a simple hello world from Haxe code to emscripten.

As Ian says, user32.lib is a Windows thing, you can not link that to a wasm program. But if it’s performance you’re after, emscripten is not the right way, it’ll likely make your Haxe code slower actually because among other problems it’ll then use the hxcpp garbage collector instead of the high end garbage collector of your browser - Haxe maps much better to JavaScript than wasm. Emscripten also isn’t terribly helpful with your write once run anywhere aims but there’s several Haxe frameworks which actually are.

Thanks RobDanerous.

Yes, I started to found limitation with emscripten and it is not to write oncee Haxe code and run on any platform.

The user32.lib error was taking me on the wrong path :blush: Reason for the error I was using -D EMSCRIPTEN rather than -D emscripten in the Main.hx. Therefore, it just ignores the request to compile for emscripten and continues to compile for cpp.

I’ve started reading more about other frameworks. Maybe take a look at Heao.io :slight_smile:

Ya, well, now I don’t like you anymore.

2 Likes

I’ve finally got it to work. I’ll uploaded the solution the the cookbook. Thanks again for all your help.

garbage collector :- Something which I need to look when selecting a Haxe framework.

I think I may have found a solution. I’m uploading the solution to the Haxe cookbook.

Haxe cookbook updated