linux平台编译 *.so文件,需要__declspec(dllimport)么
linux平台编译 *.so文件,需要__declspec(dllimport)么
最近做开始做跨平台项目,移动设备上的,以前只做过C#\C++互操作,现在要求做一套库,这套库要跨Android/Windows Mobile/WinCE三个平台,决定用标准C++来写,然后使用VC \Eclipse+NDK 分别编译,
在VC中写完代码编译成功,并成功运行,之后把所有代码放到Eclipse+NDK 中,编译,就会发现有
“expected constructor, destructor, or type conversion before '(' token ” 的错误,反复查找,原来是
我在里面使用了
#ifdef DecodeLib_API
#else
#define DecodeLib_API _declspec(dllimport)
#endif
之后声明函数时又使用了
extern "C" DecodeLib_API bool DecodeData(vector<unsigned char> & comData,int commDataLen);
如果将上面的函数声明改为
extern "C" bool DecodeData(vector<unsigned char> & comData,int commDataLen);
就不会有上面的错误了,请问下,有知道怎么回事的么,谢谢!