Thread overview
_memsetFloat Error with dmd
March 17

Hello people,

i have the following example. Compiled with dmd and ldc2

dmd main.d -betterC
ldc2 main.d -betterC

with dmd the compilation fails with

lld-link: error: undefined symbol: _memsetFloat
>>> referenced by app.obj:(main)
Error: linker exited with status 1
       C:\dev\dlang\dmd2\windows\bin64\lld-link.exe /NOLOGO "app.obj"    /LIBPATH:"C:\dev\dlang\dmd2\windows\bin64\..\lib64\mingw

The compilation fails only with dmd when I'm not assigning all the fields of a struct like in example #3. Is this a compiler error ?

struct MyStruct {
    float[4] data;
    float[16] matrix;
}

extern(C) int main() {


    MyStruct sWorks = MyStruct(
        data: [1.0f, 2.0f, 3.0f, 4.0f],
        matrix: [
            1.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 1.0f
        ]);

    MyStruct sWorks2;
    sWorks2.data = [ 1.0f, 0.0f, 0.0f, 1.0f ];

    MyStruct sNotWorking = MyStruct(
        data: [ 1.0f, 0.0f, 0.0f, 1.0f ],
        matrix: [
            1.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 1.0f
        ]);


    return 0;
}
March 17

On Monday, 17 March 2025 at 12:28:38 UTC, Maximilian Naderer wrote:

>

Hello people,

i have the following example. Compiled with dmd and ldc2

dmd main.d -betterC
ldc2 main.d -betterC

with dmd the compilation fails with

lld-link: error: undefined symbol: _memsetFloat
>>> referenced by app.obj:(main)
Error: linker exited with status 1
       C:\dev\dlang\dmd2\windows\bin64\lld-link.exe /NOLOGO "app.obj"    /LIBPATH:"C:\dev\dlang\dmd2\windows\bin64\..\lib64\mingw

The compilation fails only with dmd when I'm not assigning all the fields of a struct like in example #3. Is this a compiler error ?

struct MyStruct {
    float[4] data;
    float[16] matrix;
}

extern(C) int main() {


    MyStruct sWorks = MyStruct(
        data: [1.0f, 2.0f, 3.0f, 4.0f],
        matrix: [
            1.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 1.0f
        ]);

    MyStruct sWorks2;
    sWorks2.data = [ 1.0f, 0.0f, 0.0f, 1.0f ];

    MyStruct sNotWorking = MyStruct(
        data: [ 1.0f, 0.0f, 0.0f, 1.0f ],
        matrix: [
            1.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 1.0f
        ]);


    return 0;
}

Sorry the example should have been

struct MyStruct {
    float[4] data;
    float[16] matrix;
}

extern(C) int main() {


    MyStruct sWorks = MyStruct(
        data: [1.0f, 2.0f, 3.0f, 4.0f],
        matrix: [
            1.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 1.0f
        ]);

    MyStruct sWorks2;
    sWorks2.data = [ 1.0f, 0.0f, 0.0f, 1.0f ];

    MyStruct sNotWorking = MyStruct(
        matrix: [
            1.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 1.0f
        ]);


    return 0;
}
March 17

On Monday, 17 March 2025 at 12:28:38 UTC, Maximilian Naderer wrote:

>

Hello people,

i have the following example. Compiled with dmd and ldc2

dmd main.d -betterC
ldc2 main.d -betterC

with dmd the compilation fails with

lld-link: error: undefined symbol: _memsetFloat
>>> referenced by app.obj:(main)
Error: linker exited with status 1
       C:\dev\dlang\dmd2\windows\bin64\lld-link.exe /NOLOGO "app.obj"    /LIBPATH:"C:\dev\dlang\dmd2\windows\bin64\..\lib64\mingw

This is a known bug in BetterC:

https://github.com/dlang/dmd/issues/19579