I tried to use a function from a library written in C++ in D.
I've been trying to use it in D. But I got an error in LNK2019
and the build failed.
So I created a simple static library as follows and built it.
```cpp
#pragma once
#include <windows.h>
namespace static_test {
void str_test(LPCSTR str)
{
MessageBoxA(NULL, str, NULL, MB_OK);
}
void wstr_test(LPCWSTR str)
{
MessageBoxW(NULL, str, NULL, MB_OK);
}
void rect_test(RECT rect)
{
}
}
```
```d
import core.sys.windows.windows;
import std.utf;
extern (C++, "static_test") {
nothrow @nogc
extern void str_test(LPCSTR str1);
nothrow @nogc
extern void wstr_test(LPCWSTR str1);
nothrow @nogc
void rect_test(RECT rect);
}
void main()
{
str_test(toUTFz!(const char*)("test"));
// error LNK2019
wstr_test(toUTF16z("test"w));
// error LNK2019
rect_test(RECT.init);
}
```
The LNK2019 error still occurred.
I'm guessing that the reason for the error is that the type
declared in C++ is different from the type declared in D. But I'm
not sure how to fix it.