Using C++ Classes From D: dmd cannot link, while ldc segfault

mw mingwu at gmail.com
Mon Jun 19 06:35:31 UTC 2023


If I use array:

```
extern(C++) {

void getInts(core.stdcpp.array.array!(int, 10) vec) {
   foreach (int i; 0 .. 10) {
     vec.at(i) = i;
   }
}

}
```

```
#include <array>
using namespace std;

void getInts(array<int,10>* vector);
```

Both DMD and LDC has link error:

base.cpp:42: undefined reference to `getInts(std::array<int, 
10ul>*)'


More information about the Digitalmars-d-learn mailing list