Proposed strategy to support WASM in D

Sebastiaan Koppe mail at skoppe.eu
Fri Nov 25 20:18:18 UTC 2022


On Thursday, 24 November 2022 at 20:22:43 UTC, AnimusPEXUS wrote:
> Have question(s) on Sebastiaan's wasm.
>
> 1. Sebastiaan, does your wasm realization concentrates 
> primarily on wasi interfacing, or will it allows wasm usage in 
> [wasm]+[js glue] fashion?

DRuntime depends on libc. So if you want to use DRuntime in WASM 
you need a WASM implementation of libc. That is what WASI-libc 
provides.

Why WASI? Well, it is the interface many WASM runtimes use.

That is all my DRuntime 'port' does.

> 2. if [wasm]+[js glue] fashion is not supported by Sebastiaan's 
> wasm realization, then I, I think need to concentrate on 
> [wasm]+[js glue] variant. so if this is the case, then how to 
> separate [wasm wasi] version from [wasm]+[js glue] version in 
> druntime.

Interfacing with JS is out of the scope of the DRuntime WASM/WASI 
port.

In the Spasm library I have a bindgen tool that spits out D/JS 
glue code based on web IDL files.

It allows you to call pretty much every web api out there.

Before my current job I briefly worked on one that creates D/JS 
glue code for typescript libraries. It isn't finished, but it 
shows its viable.


More information about the Digitalmars-d mailing list