回复:WINCC 中调用外部用户DLL库,多参数返回的问题.

www95

西门子1847工业学习平台

  • 帖子

    163
  • 精华

    1
  • 被关注

    17

论坛等级:游侠

注册时间:2006-04-25

普通 普通 如何晋级?

发布于 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)
评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC WinCC / Panel

共有32568条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。