Reputation: 4808
Test.vcxproj
).#include "Test.h"
.I have noticed this behavior a long time ago but I forgot about it. Today I had a hard time trying to understand, again, what it is happening.
I do not see why this is normal since the header is part of the project.
Thank you.
class TEST_API CTest
{
public:
virtual ~CTest() = 0 {}
};
Upvotes: 0
Views: 51
Reputation: 63154
Referencing the header in the project file is a red herring. You can, indeed, exclude it from the base working example and everything still works. The actual files being processed are the .cpp files.
DLL imports and exports are generated by the compiler (and later used by the linker) when encountering __declspec(dllimport)
and __declspec(dllexport)
attributes, as used in your class. However, since no .cpp file includes your header, the compiler never encounters your class at all. Hence, no export.
Note that, even if your class ends up in a compiled file and the exports appear, your destructor is implicitly inline
and thus a user of the library might (or will, I'm not 100% sure) generate and use its own definition rather than importing the one from the DLL.
Upvotes: 2