Constructor / Destructor Linking Error

Viewed 650

I have a project (that creates a dll), say test.dll, where I am not exporting the constructor and destructor of a class, say TestClass, out in the dll. This is because I have some factory functions that are supposed to be invoked to create and destroy objects of TestClass. This design works perfectly fine in stand alone examples that I create where I try to use objects of TestClass from test.dll.

However when I link this test.dll (or the .lib in my case since I am using Visual Studio) to a project in our production module, I get weird linking errors pointing to the constructor and destructor that it could not find for TestClass. I know for a fact that I don't call new / delete, or create any stack instance of TestClass anywhere in the project. The production module uses C#/CLR/CLI along with C++ I think. The only way to get around is for me to export the constructor and destructor for TestClass. This is undesirable by design.

Is this situation familiar to anyone? Can some one point to what might be the issue?

This is the error that I get:

Error   5264    error LNK2028: unresolved token (0A000BA3) "public: virtual __thiscall BE::TestClass::~TestClass(void)" (??1TestClass@BE@@$$FUAE@XZ) referenced in function "public: virtual void * __thiscall BE::TestClass::`vector deleting destructor'(unsigned int)" (??_ETestClass@BE@@$$FUAEPAXI@Z)  AMBestDetailBridge.obj  BEBase

Error   5373    error LNK2001: unresolved external symbol "public: virtual __thiscall BE::TestClass::~TestClass(void)" (??1TestClass@BE@@$$FUAE@XZ) AMBestDetailBridge.obj  BEBase

Thanks!

1 Answers
Related