How to pass a class by (const) reference to C++
Jan
Jan at Krassnigg.de
Wed Dec 15 19:28:44 UTC 2021
On Wednesday, 15 December 2021 at 17:10:51 UTC, Tim wrote:
> Do you have a test case for your problem?
C++
```cpp
class Test
{
public:
__declspec(dllexport) static int var;
};
int Test::var = 42;
```
D
```cpp
extern(C++, class) struct Test
{
extern (C++) export extern __gshared int var;
}
```
(also tried without the duplicate extern(C++) and without
'export')
DLL compiled with Visual Studio 2019. D DLL compiled with a 3 day
old nightly build of DMD.
DMD says:
`error LNK2019: unresolved external symbol "public: static int
Test::var" (?var at Test@@2HA)`
I've checked the .exp file of the DLL where the symbol is defined
in, and it has the exact same name there. And yes, I correctly
link against that DLL in general, other symbols located in that
DLL are linked just fine by DMD.
More information about the Digitalmars-d-learn
mailing list