Need help with Windows linkage ( DMD using ImportC)
Carl Sturtivant
sturtivant at gmail.com
Tue Mar 5 00:20:36 UTC 2024
On Monday, 4 March 2024 at 21:21:20 UTC, Carl Sturtivant wrote:
> ```
> blah.obj: error LNK2019: unresolved external symbol _mul128
> referenced in function MultiplyExtract128
> blah.obj: error LNK2019: unresolved external symbol
> __shiftright128 referenced in function MultiplyExtract128
> blah.obj: error LNK2019: unresolved external symbol _umul128
> referenced in function UnsignedMultiplyExtract128
> blah.obj: error LNK2019: unresolved external symbol __stosb
> referenced in function RtlSecureZeroMemory
> blah.obj: error LNK2019: unresolved external symbol
> __readgsqword referenced in function NtCurrentTeb
> blah.obj: error LNK2019: unresolved external symbol
> __imp_MapViewOfFileNuma2 referenced in function MapViewOfFile2
> blah.obj: error LNK2019: unresolved external symbol
> __imp_CharUpperW referenced in function ua_CharUpperW
> ```
I forced linkage of these unused symbols as follows, but it would
be nice to have a clean way to proceed.
```D
extern(C) {
int _InterlockedExchangeAdd(int* Addend, int Value) { return
0; };
long _InterlockedExchangeAdd64(long* Addend, long Value) {
return 0; }
void _mul128() {};
void __shiftright128() {};
void _umul128() {};
void __stosb() {};
void __readgsqword() {};
void __imp_MapViewOfFileNuma2() {};
void __imp_CharUpperW() {};
}
```
I got the D signatures of the first two so as to generate the
correct linkage by using ImportC to translate the inclusion of
`Windows.h` into a .di file, and searching.
More information about the Digitalmars-d-learn
mailing list