extern "C" _declspec (dllexport)和_declspec (dllexport)的分别,看看我理解对不对?
我发现在如果DLL里边的函数用extern "C" _declspec (dllexport)使用函数,就可以用LoadLibrary来使用DLL。
而用_declspec (dllexport)的时候,只有隐式调用。显式调用错误。对不对?
像下列的,我用显试调用的时候不能调用。然后用查看工具看DLL里边的函数是乱码。如果显式调用SQU这个函数的话,调用不了,错误。如用extern "C" _declspec int SQU(int) 方式,就可以显式设用,这究竟是什么问题,很不方便。有什么方法,显式、隐式都能用呢?
#ifdef C_CPP_DLL
#define MYDLL extern "C" _declspec (dllexport)
#else
#define MYDLL _declspec(dllexport)
#endif
MYDLL int SQU(int);