If you use the
Visual Studio
wizard to generate
DLL
skeleton (specifying 'export symbols') then you may find, in the generated code, the following remark:
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the MYDLL_EXPORTS
// symbol defined on the command line. This symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// MYDLL_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef MYDLL_EXPORTS
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif
I suppose it explains your problem: while the DLL build
must use __declspec(dllexport)
, the application one should use
__declspec(dllimport)
(or don't use,
in the application build,
__declspec
at all, see
here[
^]).