Thread overview
What's the current status of WASM/WASI support?
Mar 14
ChrisG
Mar 15
Hipreme
Mar 15
ChrisG
Mar 15
Hipreme
March 14

In 2019, there was a blog post that indicated a strong push for wasm support was afoot. I've had a hard time pulling together information since then. I was curious if anyone has a good general perspective on the state of D wasm support. I can't tell if it's a mostly dead subject. It looks like betterC support is generally there, but I'm not sure about runtime or library support. Specifically, I was interested in:

  • What's the runtime support story (can I use GC)?
  • What's the phobos support story?
  • Are there alternate general purpose libraries folks have settled on for wasm development? (spasm?)
  • Anything about WASI or Emscripten?

Thanks.

March 15

On Tuesday, 14 March 2023 at 23:45:12 UTC, ChrisG wrote:

>

In 2019, there was a blog post that indicated a strong push for wasm support was afoot. I've had a hard time pulling together information since then. I was curious if anyone has a good general perspective on the state of D wasm support. I can't tell if it's a mostly dead subject. It looks like betterC support is generally there, but I'm not sure about runtime or library support. Specifically, I was interested in:

  • What's the runtime support story (can I use GC)?
  • What's the phobos support story?
  • Are there alternate general purpose libraries folks have settled on for wasm development? (spasm?)
  • Anything about WASI or Emscripten?

Thanks.

Hipreme Engine has been ported to WASM.
There's a way to include the custom runtime I'm using right now. You can use almost the complete runtime, although it does not collect. If you're not leaking memory you're fine.

You can check the announcement post here. Just do your part and in the future we'll be able to have some official D runtime. For the time being it can work for 90% of the use cases.
https://forum.dlang.org/post/gtmlwwkovmuphrmfgvtf@forum.dlang.org

March 15

On Wednesday, 15 March 2023 at 03:44:21 UTC, Hipreme wrote:

>

Hipreme Engine has been ported to WASM.
There's a way to include the custom runtime I'm using right now. You can use almost the complete runtime, although it does not collect. If you're not leaking memory you're fine.

Wow. That's an impressive feat.

This is the runtime you're using for wasm?
https://github.com/MrcSnm/webassembly/tree/f60b02feca726ab5c01d1bd0d888a9a72282ab9b

March 15

On Wednesday, 15 March 2023 at 17:35:42 UTC, ChrisG wrote:

>

On Wednesday, 15 March 2023 at 03:44:21 UTC, Hipreme wrote:

>

Hipreme Engine has been ported to WASM.
There's a way to include the custom runtime I'm using right now. You can use almost the complete runtime, although it does not collect. If you're not leaking memory you're fine.

Wow. That's an impressive feat.

This is the runtime you're using for wasm?
https://github.com/MrcSnm/webassembly/tree/f60b02feca726ab5c01d1bd0d888a9a72282ab9b

Yes, you can follow the code from my engine as a guide into how to integrate the custom runtime in your project.

Also, if you wish to try dub libraries compiled with that custom runtime, you'll need to set the DFLAGS variable before calling dub. This is the reason you'll find plenty of shell and batch files.

Hipreme Engine has its own standard library as I prefer having this kind of control for testing on every platform, and also not even depending on libc. Although that happens, I still have a minimal libc port localized on modules/d_std of my engine.

If you wish to work with WASM, you'll need to deal with some problems such as loading files, getting directory files list, or those things which my engine has already dealt with as it needs a FS abstraction for every platform.

It is quite some work but well, everything has been done, specially since I used +- 1 month to get this runtime to that level. This custom runtime also works on PS Vita.