compile D to asm.js using ldc --betterC and emcc

Joakim dlang at joakim.fea.st
Tue Nov 14 14:31:22 UTC 2017


On Tuesday, 14 November 2017 at 10:01:51 UTC, SrMordred wrote:
> On Sunday, 8 October 2017 at 09:48:57 UTC, Dukc wrote:
>> On Saturday, 7 October 2017 at 17:31:37 UTC, cosinus wrote:
>>> I wrote a little working demo that shows how to use D inside 
>>> firefox.
>>>
>>> It uses emscripten(emcc) and ldc.
>>>
>>> https://github.com/cosinus2/dlang-emscripten-demo
>>
>> Judging by looking at that build script, sure that's simpler 
>> than what I read you had to do some time back! You had to 
>> switch to some legacy llvm and compile the indermediate first 
>> to C and only then to Asm.js.
>>
>> This looks like powerful enough for normal use. You still miss 
>> DRuntime but a lot better than using C to do the same. Perhaps 
>> even better than Typescript in some cases?
>
> Can someone explain the reasons why LDC can't compiles to 
> webasm with the DRuntime?

Nobody has done the work to port it, though someone has expressed 
interest and opened an issue for it:

https://github.com/ldc-developers/ldc/issues/2144

Regarding porting druntime, I'm told by some here that there are 
some issues with the GC and thread-local storage because of the 
particular wasm instruction set, but I've never looked into it.


More information about the Digitalmars-d-announce mailing list