December 19
I'm developing a plugin system for a D program.

I have a complex class hierarchy which will be complied into our executable, and I want
third parties to be able to further extend it with their own DLLs - subject to implementing an API present in the most derived class - which will be provided to the user as a auto generated header (.di) file using "dmd -H [modules]"


For example, in our program:

---
class A
{
    //Protected and public methods
}


class B : A
{
    //Protected and public methods.

    public string apiMethod()
    {
        return "Class B";
    }

}
---

And in a typical "Dll to be' plugin:

---

import B; //Currently using a 'header' file generated with dmd -H b.d;

mixin dllBoilerplate;


export class C : B
{
   //Public (export?) API implimentation
    override public string apiMethod()
    {
        return "Class C";
    }

   //Private methods
}


Currently, when I try to compile the plugin DLL, I get linker errors that mangled symbol for apiMethod is not defined - These are the symbols defined in the header (b.di) file, but are not implemented: by definition intended to be part of the main program, instead.

Can anyone explain how I should go about building the plugin - I suspect it involved what I am and am not declaring 'export', but I'm unable to find any material that puts light on my situation.

Thanks.

ST.







December 20
I am afraid to say this has quite a simple answer.

TypeInfo (and with that vtables used as part of classes), do not cross the dll boundary (other platforms things mostly work).

Which means, can't do what you are wanting I'm afraid.

It is an implementation issue that we REALLY REALLY REALLY need to fix.