_declspec(dllexport)与_declspec(dllimport)
_declspec(dllexport)作用:
These attributes explicitly define the DLL's interface to its client, which can be the executable file or another DLL. Declaring functions as dllexport eliminates the need for a module-definition (.DEF) file, at least with respect to the specification of exported functions.
注意:
dllexport of a C++ function will expose the function with C++ name mangling. If C++ name mangling is not desired, either use a .def file (EXPORTS keyword) or declare the function as extern "C".
_declspec(dllimport)是在别的程序里面调用的时候需要进行的声明。只有在DLL内部dllexport之后,在外部才可以被import。
参考: