D and WebAssembly (Wasm)

Sebastiaan Koppe mail at skoppe.eu
Mon Sep 13 21:14:16 UTC 2021


On Monday, 13 September 2021 at 17:19:23 UTC, Ferhat Kurtulmuş 
wrote:
> You don't need to compile d code to c. You can use d code with 
> emscripten. Sebastiaan Koppe was working on druntime[1] to make 
> it possible to use it with webassembly. Dunno its current 
> status. Here is also my d game using wasm. It even links with c 
> libraries compiled with emscripten.
>
> https://aferust.github.io/drawee/
> https://github.com/aferust/drawee
>
> [1]: https://github.com/skoppe/druntime/tree/wasm

Yes, just yesterday I started to get back to that work again. I 
am currently updating to latest ldc and wasi sdk. Couple of 
months ago all druntime/phobos tests were passing and I hope to 
get there again (well, all except thread/fibers/exceptions, since 
they aren't suported).

You can already use the forks to build ldc phobos/druntime libs 
for use in wasm. It is a bit cumbersome to setup but it works.

If that isn't your cup of tea - won't blame you - you'll have to 
stick to adam's custom runtime or plain betterC, which also works 
fine. Especially since spasm has bindings to all web api's.

examples:

https://skoppe.github.io/spasm/examples/todo-mvc/
https://skoppe.github.io/spasm/examples/underrun/
https://skoppe.github.io/spasm-imgui/



More information about the Digitalmars-d mailing list