www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Dlang + emscripten

reply SrMordred <patric.dexheimer gmail.com> writes:
I´m following this link to build d+sdl2+emscripten on web:
https://theartofmachinery.com/2018/12/20/emscripten_d.html

And, i´m was able to compile but i get the warnings
warning: Linking two modules of different data layouts / target 
triples
even when I compile using x86. So i´m not sure if this is a LDC 
or Emscripten issue.

Someone is also exploring emscripten?
May 16 2019
parent reply Dukc <ajieskola gmail.com> writes:
On Thursday, 16 May 2019 at 18:23:12 UTC, SrMordred wrote:
 I´m following this link to build d+sdl2+emscripten on web:
 https://theartofmachinery.com/2018/12/20/emscripten_d.html

 And, i´m was able to compile but i get the warnings
 warning: Linking two modules of different data layouts / target 
 triples
 even when I compile using x86. So i´m not sure if this is a LDC 
 or Emscripten issue.

 Someone is also exploring emscripten?
I did previously use it. It is tedious, but can be done if you have basic understanding of what you're doing and try long enough. LDC does not know it's compiling to Emscripten, it outputs bytecode thinking it'll be compiled to some other platform. This is bound to cause all sort of problems when you try to import anything. I recommend you use https://code.dlang.org/packages/spasm (which I have ported my code to) instead. You definitely will have nowhere as easy time working with them as with desktop, but it's better than a homemade ldc-linker-emscripten build system. You are also able to generate D bindings to web apis here, no need to write JavaScript wrappers manually. Disadvantages are that you don't have a C runtime, and you can only target WebAssembly which is more difficult to call from JavaScript than asm.js. If you still choose to use Emscripten, check https://github.com/CyberShadow/dscripten-tools. Unlike Spasm, it won't give you web API, but it should ease development in other ways and give you some of the standard library stuff you don't have otherwise. I haven't used it so no idea how good it is in practice. Generally, D is not currently good at targeting JavaScript. Just good enough that an experienced D coder could get it competitive in the right situation, but generally not good.
May 16 2019
parent SrMordred <patric.dexheimer gmail.com> writes:
On Thursday, 16 May 2019 at 19:27:15 UTC, Dukc wrote:
 On Thursday, 16 May 2019 at 18:23:12 UTC, SrMordred wrote:
 [...]
Nice will take a look on this two, thanks :)
May 17 2019