[[bad mustMatch:]]: error while compiling to wasm
Hüseyin Akbaş
huskb.code at gmail.com
Sun Jul 8 09:01:09 UTC 2018
On Saturday, 7 July 2018 at 18:01:46 UTC, kinke wrote:
> On Saturday, 7 July 2018 at 07:55:59 UTC, Hüseyin Akbaş wrote:
>> Hi I was trying to build wasm code via ldc and binaryen. I saw
>> how to do it in a c++ tutorial.
>>
>> My source code is:
>>
>> import std.stdio;
>>
>> extern(C) int main()
>> {
>> writeln("Edit source/app.d to start your project.");
>> return 0;
>> }
>>
>>
>> I compile with the following:
>> ldc2 app.d -output-s
>> s2wasm app.s > app.wast
>
> LDC will soon be able to compile & link some trivial D code
> directly to WebAssembly, without any external tools. Don't
> expect a seamingly simple `writeln()` to work soon though [you
> don't even have access to the console in WebAssembly and must
> interop with a JavaScript function to do so AFAIK].
> See
> https://github.com/ldc-developers/ldc/pull/2766#issuecomment-403222908 for how to get started.
Some guy has created a toolchain like emscripten in order to
compile a few libraries for webasm with the D code. However, I
couldn't make it work. Here is the link:
https://github.com/CyberShadow/dscripten-tools What do you think?
Is it useful?
More information about the digitalmars-d-ldc
mailing list