LDC: Where is this supposed to link to?

Dukc ajieskola at gmail.com
Tue Jun 12 17:37:30 UTC 2018


I have just managed to include a bit D code in a C# project 
compiled to Javascript. I am already looking at extending LDC 
runtime to open more possibilites, but something seems fishy.

All DRuntime code the compiler can invoke directly is in 
object.d, is that right?

When I try to copy a slice to another -no changing sizes, so can 
be done without GC- it compiles just fine using:

ldc2 -O1 -c dModule.d --output-bc -m32 
-d-version="Emscripten_Backend"

...and when I proceed to compile the bytecode to Javascript:

emcc -O1 dModule.bc -g2 -s EXPORT_ALL=1 -s ASSERTIONS=1 -o 
dist/dModule.js

...it still works, but with a few warnings:

warning: Linking two modules of different target triples: 
C:\Users\Yleinen\.emscripten_cache\asmjs\dlmalloc_debug.bc' is 
'asmjs-unknown-emscripten' whereas 'dModule.bc' is 
'i686-pc-windows-msvc'

warning: Linking two modules of different data layouts: 
'C:\Users\Yleinen\.emscripten_cache\asmjs\libc.bc' is 
'e-p:32:32-i64:64-v128:32:128-n32-S128' whereas 'dModule.bc' is 
'e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32'

warning: Linking two modules of different target triples: 
C:\Users\Yleinen\.emscripten_cache\asmjs\libc.bc' is 
'asmjs-unknown-emscripten' whereas 'dModule.bc' is 
'i686-pc-windows-msvc'

warning: incorrect target triple 'i686-pc-windows-msvc' (did you 
use emcc/em++ on all source files and not clang directly?)
warning: unresolved symbol: _d_array_slice_copy
warning: unresolved symbol: _d_arraybounds

The _d_array_slice_copy is now implemented in JavaScript by 
making it throw an exception about missing function. I would be 
happy to fix that function to exist, but there's something 
strange: object.d does not contain array_slice_copy, not even 
inside a version statement or static if. Where is it supposed to 
be found at, then?


More information about the Digitalmars-d-learn mailing list