Is this a compiler issue?
DLearner
bmqazwsx123 at gmail.com
Sat Dec 6 19:36:01 UTC 2025
Hi
This uses DMD64 D Compiler v2.111.0, using -betterC, under
Windows 10.
With the two commented lines in place, results are as expected.
Uncomment those two lines, even though the variable is set but
never used,
the program fails at the link stage with reference to a missing
'_memsetn'.
Ideas?
```
extern(C) void main() {
import core.stdc.stdio : printf;
import testmod : sub1 , TestStruct;
int IntVar1 = 5;
TestStruct[1] TS1;
TS1[0].VarAddr = &IntVar1;
TS1[0].VarName = "IntVar1";
TS1[0].VarInt = 3;
// TS1[0].VarType = 'N';
printf("ppm_th: Entered.\n");
printf("ppm_th: Calling sub1...\n");
sub1(TS1);
printf("ppm_th: Returned from sub1.\n");
printf("ppm_th: Exiting...\n");
}
```
The module 'testmod':
```
struct TestStruct {
void* VarAddr;
string VarName;
int VarInt;
// char VarType;
}
void sub1(TestStruct[] parmTestStruct) {
import core.stdc.stdio : printf;
printf("sub1: Entered.\n");
int* VarAddr;
size_t wkIdx;
for (wkIdx = 0; wkIdx < parmTestStruct.length; wkIdx = wkIdx +
1) {
VarAddr = cast(int*)(parmTestStruct[wkIdx].VarAddr);
printf("*VarAddr = %d\n", *VarAddr);
printf("\n");
}
printf("sub1: Exiting...\n");
}
```
More information about the Digitalmars-d-learn
mailing list