dub ldc error _d_array_slice_copy

SrMordred patric.dexheimer at gmail.com
Tue Feb 19 00:23:31 UTC 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:
>> 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);
> }

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?



More information about the Digitalmars-d-learn mailing list