网上看到很多文章写调用vc的dll,但我尝试了总是出问题,下面结合参考别人的文章,实现了Qt显示调用vs中c接口的dll。

具体直接上代码:

vs中的代码:

TMax.h:

 1 #ifdef TMAX
 2 #define TMax_API  _declspec(dllexport)
 3 #else
 4 #define TMax_API  _declspec(dllimport)
 5 #endif
 6 
 7 #ifndef  _TMAX_
 8 #define _TMAX_
 9 
10 #include <iostream>
11 using namespace std;
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 int TMax_API Tmax(int x,int y);
18 
19 #ifdef __cplusplus
20 }
21 #endif
22 
23 #endif
View Code

相关文章: