LNK2019 error in the C++ interface

dokutoku 3729541-dokutoku at users.noreply.gitlab.com
Thu Jun 10 13:19:34 UTC 2021


It's been a while since then, but the problem with the structure 
has been solved.
The reason seems to be that the structure name defined in 
core.sys.windows.windef was not tagRECT.
I was able to get it to compile by adding a custom definition as 
follows

```d
extern (C)
struct tagRECT
{
	LONG left;
	LONG top;
	LONG right;
	LONG bottom;
}

alias RECT = tagRECT;
```

The type name did not work.
The reason seems to be that WCHAR should be mangled with wcha_t, 
but it is mangled with chat16_t.
Since the mangle is wchat_t, I thought maybe I should use wchar_t 
in core.stdc.stdef, so I changed LPCWSTR to const (wchar_t)*, but 
that didn't work either.

I still haven't solved this problem.
I also took a look at Data Type Compatibility in Interfacing to 
C++, and I think it's wrong about wchar_t.

https://dlang.org/spec/cpp_interface.html#data-type-compatibility



More information about the Digitalmars-d-learn mailing list