views:

87

answers:

2

I have a class defined in one DLL, with a certain member that is overloaded. A second DLL imports that class, inherits from it and exports the inherited class. The inherited class overrides one of the overloads of the above member, and so looses all the other overloads.

The solution for this problem generally, AFAIK, is to use a using statement (using BaseClass::OverloadedMember;), but given the situation, I get an error C2487: 'BaseClass::OverloadedMember' : member of dll interface class may not be declared with dll interface (VC++).

How do I work around this?

A: 

Well, I can't test the specifics as I don't have VC++, but one way is to redefine in the base class all the overloaded methods and export them separately.

Keep in mind the import/export of VC++ was never thought properly for C++. So you should keep exported classes simple in term of C++ features (and the using statement is too complex for that purpose).

PierreBdR
+1  A: 

I'd export all versions of the overloaded function from the new DLL/class. So, rather than using a using statement to expose the base class versions because you don't need to change them in this case I would implement simple forwarding functions that explicitly call the base class versions. I expect that this would work around the problem you're experiencing; but it's less than ideal.

Len Holgate