WebAssembly image dithering example

kinke noone at nowhere.com
Thu Aug 2 22:31:40 UTC 2018


On Thursday, 2 August 2018 at 22:04:50 UTC, Allen Garvey wrote:
> I also wanted to share some of the challenges I overcame for 
> the benefits of others and I would be grateful if someone more 
> knowledgeable than me can point out if these are the results of 
> my own stupidity, or if they are due to gaps in LDC 
> documentation/implementation or the limits of WebAssembly in 
> general.

Hey, interesting, thx for sharing.

1. Won't be an issue with v1.11 final anymore, it's already fixed 
in master. Also, you won't need an explicit `-link-internally` 
anymore.

2. To be expected. Bounds errors trigger assertions, and 
assertions are redirect to the C assert with `-betterC`. See 
https://github.com/ldc-developers/ldc/blob/master/tests/baremetal/wasm2.d#L10 for how you can stub it out (or implement it properly).

3. According to a Hello-world Rust tutorial (can't find the 
link), global pointers (such as a "Hello world" string literal) 
are relative to the module's linear memory, exposed as something 
like an ArrayBuffer in exports.memory in JS IIRC. I guess that's 
all done by LLVM and doesn't need any special handling by LDC, 
but I haven't tested any of this yet.

4. I'll check it out.

5. To be expected. See 
https://github.com/ldc-developers/ldc/pull/2787 to get an idea of 
what'd be required to get parts of druntime and Phobos working 
for bare-metal targets without C runtime libs.


More information about the digitalmars-d-ldc mailing list