vc6工程可以调用VS2008的动态库dll么,该怎么处理
vc6工程可以调用VS2008的动态库dll么
有没有这方面的高手,我在vc6工程调用vs2008动态库时,链接函数的时候报错
error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall CDxfTranslate::Translate(class CString,double,class CString)" (__imp_?Translate@CDxfTranslate@@QAEHVCString@@N0@Z)
------解决方案--------------------
一般不支持,不同编译器各个类库实现不一样。不能兼容
------解决方案--------------------
dll中不要用CString作参数,切记切记!!!
CString这个东东在VC6和VS2008中实现方式不一样!!!
------解决方案--------------------
最好不要这样,因为我VS2005生成的DLL和VS2008生成的DLL彼此调用都会出问题的。
------解决方案--------------------
用统一编译器版本编译
------解决方案--------------------
那么的话,用C++写成DLL供C#调用的怎么办?
------解决方案--------------------
动态加载和调用
LoadLibrary GetProcAddress FreeLibrary
------解决方案--------------------
只能考楼上的动态加载和调用
LoadLibrary GetProcAddress FreeLibrary
------解决方案--------------------
直接用2008不好吗
------解决方案--------------------
可以直接调用,但是编译的时候需要生成标准的WIN32 库
不能输出类和其他一些MFC 的东东,这样生成的库可以跨语言。
输出的宏定义如下:
#ifdef _WIN32
#ifdef AORE_COMM_EXPORTS
#ifdef __cplusplus
#define AORE_COMM_API extern "C" __declspec (dllexport)
#else
#define AORE_COMM_API __declspec (dllexport)
#endif
#else //AORE_COMM_EXPORTS
#ifdef __cplusplus
#define AORE_COMM_API extern "C" __declspec (dllimport)
#else //__cplusplus
#define AORE_COMM_API __declspec (dllimport)
#endif //end __cplusplus
#endif //end AORE_COMM_EXPORTS
#else // _WIN32
#ifdef __cplusplus
#define AORE_COMM_API extern "C"
#else
#define AORE_COMM_API
#endif
#endif // _WIN32
有没有这方面的高手,我在vc6工程调用vs2008动态库时,链接函数的时候报错
error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall CDxfTranslate::Translate(class CString,double,class CString)" (__imp_?Translate@CDxfTranslate@@QAEHVCString@@N0@Z)
------解决方案--------------------
一般不支持,不同编译器各个类库实现不一样。不能兼容
------解决方案--------------------
dll中不要用CString作参数,切记切记!!!
CString这个东东在VC6和VS2008中实现方式不一样!!!
------解决方案--------------------
最好不要这样,因为我VS2005生成的DLL和VS2008生成的DLL彼此调用都会出问题的。
------解决方案--------------------
用统一编译器版本编译
------解决方案--------------------
那么的话,用C++写成DLL供C#调用的怎么办?
------解决方案--------------------
动态加载和调用
LoadLibrary GetProcAddress FreeLibrary
------解决方案--------------------
只能考楼上的动态加载和调用
LoadLibrary GetProcAddress FreeLibrary
------解决方案--------------------
直接用2008不好吗
------解决方案--------------------
可以直接调用,但是编译的时候需要生成标准的WIN32 库
不能输出类和其他一些MFC 的东东,这样生成的库可以跨语言。
输出的宏定义如下:
#ifdef _WIN32
#ifdef AORE_COMM_EXPORTS
#ifdef __cplusplus
#define AORE_COMM_API extern "C" __declspec (dllexport)
#else
#define AORE_COMM_API __declspec (dllexport)
#endif
#else //AORE_COMM_EXPORTS
#ifdef __cplusplus
#define AORE_COMM_API extern "C" __declspec (dllimport)
#else //__cplusplus
#define AORE_COMM_API __declspec (dllimport)
#endif //end __cplusplus
#endif //end AORE_COMM_EXPORTS
#else // _WIN32
#ifdef __cplusplus
#define AORE_COMM_API extern "C"
#else
#define AORE_COMM_API
#endif
#endif // _WIN32