发布于 2011-05-24 09:52:41
15楼
extern "C" __declspec (dllexport) int aufruf1(int a);
#include
#include
FILE *h_test;
FILE *h_trace;
extern "C" __declspec (dllexport) int aufruf1(int a)
{
struct stationinfo
{
int type ;
int port;
char * ip;
char * addr;
};
stationinfo stationinfo_1;
switch(a)
{
case 1:
{
stationinfo_1.type=1111;
stationinfo_1.port=6021;
stationinfo_1.ip="192.168.1.10";
stationinfo_1.addr="r";
return stationinfo_1;
}break;
case 2:
{
stationinfo_1.type=2222;
stationinfo_1.port=6022;
stationinfo_1.ip="192.168.1.11";
stationinfo_1.addr="y";
return stationinfo_1;
}break;
default:
{
}break;
}
}
斑竹你好,以上是改后的程序,以下是编译后的出错的信息.定义DLL返回值类型名称的错误在哪里?
Compiling...
20110520.cpp
E:\20110520\20110520.cpp(48) : error C2440: 'return' : cannot convert from 'struct aufruf1::stationinfo' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
E:\20110520\20110520.cpp(57) : error C2440: 'return' : cannot convert from 'struct aufruf1::stationinfo' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
执行 cl.exe 时出错.
20110520.obj - 1 error(s), 0 warning(s)