pb9调用C++编写的DLL,调用时出现数据类型出错

hehong123 2013-08-29 09:27:15
Error: Specified argument type differs from required argument type at runtime in DLL function rtunyeartest.
(invalid stack pointer on return from function call) at line 16 in open event of object pbtest.

以下为C++

typedef unsigned char u_8 ;
typedef unsigned short u_16;
typedef unsigned int u_32;
typedef char i_8;
typedef short i_16;
typedef int i_32;
typedef unsigned char LI;
//AbsoluteTime
typedef struct {
u_8 century;
u_8 year;
u_8 month;
u_8 day;
u_8 hour;
u_8 minute;
u_8 second;
u_8 sec_fractions;//not used
}AbsoluteTime;
int _stdcall rtunyeartest(AbsoluteTime stuAbsoluteTime)

PB定义结构体 这里INT,LONG,STRING ,CHAR都试过了
global type absolutetime from structure
int century
int year
int month
int day
int hour
int minute
int second
int sec_fractions
end type

function long rtunyeartest(ref AbsoluteTime stabsolutetime) Library "TESTDLL.dll"

AbsoluteTime lst_absolutetime
lst_absolutetime.century=21
lst_absolutetime.year =2013
lst_absolutetime.month =8
lst_absolutetime.day=12
lst_absolutetime.hour =11
lst_absolutetime.minute =11
lst_absolutetime.second =21
lst_absolutetime.sec_fractions =2
messagebox('',rtunyeartest(ref lst_absolutetime))
报开始上面的错误
...全文
110 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
WorldMobile 2013-08-30
  • 打赏
  • 举报
回复
引用 1 楼 qq281803181 的回复:
int _stdcall rtunyeartest(AbsoluteTime stuAbsoluteTime) 改成这样搞定 int _stdcall rtunyeartest(AbsoluteTime* stuAbsoluteTime)
做dll的参数和返回值最好用普通类型如long或者string之类的,用结构的话,比较麻烦。
hehong123 2013-08-29
  • 打赏
  • 举报
回复
int _stdcall rtunyeartest(AbsoluteTime stuAbsoluteTime) 改成这样搞定 int _stdcall rtunyeartest(AbsoluteTime* stuAbsoluteTime)

740

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 脚本语言
社区管理员
  • 脚本语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧