www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - _memsetFloat Error with dmd

reply Maximilian Naderer <maximilian.wallinger outlook.com> writes:
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 

error ?

```d
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;
}
```
Mar 17
next sibling parent Maximilian Naderer <maximilian.wallinger outlook.com> writes:
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 

 error ?

 ```d
 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 ```d 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; } ```
Mar 17
prev sibling parent Paul Backus <snarwin gmail.com> writes:
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
Mar 17