On 9/28/22 12:57, Riccardo M wrote:

> class MyClass {
> public:
>      int field;
>      MyClass(int a) : field(a) {}

Make the following function 'virtual':

>      int add(int asd) {

    virtual int add(int asd) {

I think the C++ class does not get a vptr without a virtual function and apparently D expects this.

>              final int add(int asd);

You don't need that 'final' anymore.

> This is a very simplified version of the dlang official example of
> interfacing with C++ classes.

The example there uses virtual functions. That must be the difference.

> I need to declare every class method as
> "final" otherwise I get  undefined references during linking. Is this
> expected behaviour?

Apparently, not with that added 'virtual'.

Ali


Reply via email to