digitalmars.D.learn - dub ldc error _d_array_slice_copy
- SrMordred (12/12) Feb 18 2019 On ubuntu:
On ubuntu: void test(size_t l) { char* a; a[0 .. l] = a[0 .. l]; } extern(C) void main(){ test(0); } ldc2 source/app.d //compiles dub --compiler=ldc2 //app.d:4: error: undefined reference to '_d_array_slice_copy'
Feb 18 2019
oh, and: DUB version 1.13.0, built on Feb 17 2019 LDC - the LLVM D compiler (1.14.0): based on DMD v2.084.1 and LLVM 7.0.1
Feb 18 2019
On Monday, 18 February 2019 at 19:14:42 UTC, SrMordred wrote:oh, and: DUB version 1.13.0, built on Feb 17 2019 LDC - the LLVM D compiler (1.14.0): based on DMD v2.084.1 and LLVM 7.0.1Sorry, both give the same error, the problem is related to -betterC flag (which i forgot to add on first compile example), but stil..
Feb 18 2019
On Monday, 18 February 2019 at 19:10:50 UTC, SrMordred wrote:dub --compiler=ldc2 //app.d:4: error: undefined reference to '_d_array_slice_copy'Dub has nothing to do with it, it's the -betterC flag, and LDC expecting that druntime function to be available for slice copies. Quick workaround: add a manual version (here without any checks) somewhere in your code: extern(C) void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen, size_t elemsz) { import ldc.intrinsics : llvm_memcpy; llvm_memcpy!size_t(dst, src, dstlen * elemsz, 0); }
Feb 18 2019
On Monday, 18 February 2019 at 23:40:20 UTC, kinke wrote:On Monday, 18 February 2019 at 19:10:50 UTC, SrMordred wrote:Thanks, I discovered this workaround too :) But I dont get it: -betterC aren't supoused to be D without any druntime? Why it is searching for this function?dub --compiler=ldc2 //app.d:4: error: undefined reference to '_d_array_slice_copy'Dub has nothing to do with it, it's the -betterC flag, and LDC expecting that druntime function to be available for slice copies. Quick workaround: add a manual version (here without any checks) somewhere in your code: extern(C) void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen, size_t elemsz) { import ldc.intrinsics : llvm_memcpy; llvm_memcpy!size_t(dst, src, dstlen * elemsz, 0); }
Feb 18 2019