Using this C++ class:
```
struct Test
{
__declspec(dllexport) static const int const_vars[2];
__declspec(dllexport) static int nonconst_vars[2];
};
const int Test::const_vars[2] = {11, 23};
int Test::nonconst_vars[2] = {12, 24};
```
And this D declaration:
```
extern(C++) struct Test
{
extern export static __gshared const(int)[2] const_vars;
extern export static __gshared int[2] nonconst_vars;
}
```
You CAN access 'nonconst_vars' just fine, but you CAN'T access 'const_vars'.
DMD wants to link against:
?const_vars@Test@@2PAHB
which is:
public: static int * const Test::const_vars
MSVC exports:
?const_vars@Test@@2QBHB
which is:
public: static int const * const Test::const_vars
So far I haven't found a way to work around this, so accessing constant arrays seems to be impossible at the moment.
Comment #1 by nick — 2023-06-24T14:57:30Z
Similar to issue 16359.
Comment #2 by robert.schadek — 2024-12-13T19:19:55Z