Given a DLL with the following classes :
#define DLLAPI __declspec(...)
class DLLAPI Base
{
public:
virtual void B();
};
class Derived : public Base
{
public:
virtual void B();
virtual void D();
};
Will my "Derived" class be visible outside of the dll even if the "DLLAPI" keyword is not applied to the class definition (at least, not directly)?
Is the "D()" function visible to?
Thanks
class Derived won't be exported by your DLL. Classes don't inherit exporting. Add DLLAPI to that too.
Note too that class members default to private accessibility, so none of your methods should be accessible. However, I do see Base::B() being exported in my test. The C++ header in the DLL-using code would flag the error, but I wonder if you tweaked the header there, if you could fool it.
Anyway, if you did instantiate a Derived inside your DLL (via another entry point), the virtual table should still work, so if you did:
Base* b = getTheDerived(); b->B();
you'd invoke Derived::B().