ImportC: Windows.h

name n at m.e
Thu Nov 30 08:35:21 UTC 2023


Does anyone know of a workaround? (I'm using DMD 2.105.3.)

main.d:
```d
import wintest;

pragma(lib, "user32");

void main() {
     MessageBoxA(null, cast(char*)"", cast(char*)"", MB_OK);
}
```

wintest.c:
```c
#include <Windows.h>
```

```
D:\dmd.2.105.3.windows>"D:\dmd.2.105.3.windows\dmd2\windows\bin64\dmd.exe" -m64 main.d wintest.c
main.obj : error LNK2019: unresolved external symbol 
_InterlockedExchangeAdd referenced in function 
_InlineInterlockedAdd
main.obj : error LNK2019: unresolved external symbol 
_InterlockedExchangeAdd64 referenced in function 
_InlineInterlockedAdd64
main.obj : error LNK2019: unresolved external symbol _mul128 
referenced in function MultiplyExtract128
main.obj : error LNK2019: unresolved external symbol 
__shiftright128 referenced in function MultiplyExtract128
main.obj : error LNK2019: unresolved external symbol _umul128 
referenced in function UnsignedMultiplyExtract128
main.obj : error LNK2019: unresolved external symbol __stosb 
referenced in function RtlSecureZeroMemory
main.obj : error LNK2019: unresolved external symbol 
__readgsqword referenced in function NtCurrentTeb
main.obj : error LNK2019: unresolved external symbol 
__imp_MapViewOfFileNuma2 referenced in function MapViewOfFile2
main.exe : fatal error LNK1120: 8 unresolved externals
Error: linker exited with status 1120
```

**Related:**
[Issue 23894 - ImportC: _InterlockedExchangeAdd and a ton of 
other VC intrinsics are not 
recognized](https://issues.dlang.org/show_bug.cgi?id=23894)
[Issue 20020 - Compiler should offer atomic 
intrinsics](https://issues.dlang.org/show_bug.cgi?id=20020)


More information about the Digitalmars-d-learn mailing list