I seem to be able to use __declspec(dllexport)
and __declspec(dllimport)
interchangeably when building my dll in Visual Studio 2015. I would have thoug
If you look carefully, you will see that your DLL project compiles with warnings, like this:
c:\yourproject\add.cpp(3,1):warning C4273: 'add': inconsistent dll linkage
The compiler knows that you are up to no good. A dllimport
function should not be defined, only declared. So when the compiler sees the definition, it assumes dllexport
should be used instead, because that's the most reasonable resolution of the mistake.
It is a good practice to treat compiler warnings as errors.