动态库调用声明的问题

htz1977 2012-08-01 08:32:25
动态库中的一函数,在DELPHI 里的声明是
function setxfms(port:integer;btl:integer;jh:integer;zt:string):boolean;stdcall;External 'project.dll' name 'setxfms';

其中:
参数:port: 串口号
Btl:波特率
jh:机号
zt:工作模式 (00--固定消费,01--手动消费,02--菜单消费)


我在PB里的声明是:
function boolean setxfms(int port,long btl,int jh, string zt) library 'project2.dll' ;//下传工作模式

但在程序里调用的时候测不通,在DELPHI里测的通,
PB里后来改为setxfms(3,9600,2,'02') 也是不通,

请问是不是声明出错了,应该怎么声明的。

谢谢!!!!
...全文
3834 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
andonly2008 2012-08-29
  • 打赏
  • 举报
回复
2楼是对的!!!
WorldMobile 2012-08-28
  • 打赏
  • 举报
回复
delphi里的integer相当于pb中的long


如果在pb10以下版本这样应该可行
function boolean setxfms(long port,long btl,int jh, string zt) library 'project2.dll'

pb10及以上版本
function boolean setxfms(long port,long btl,int jh, string zt) library 'project2.dll' alias for "setxfms;Ansi"
网络橘子 2012-08-25
  • 打赏
  • 举报
回复
声明没有错,你调试下运行结果,估计是用法不对!!

793

社区成员

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

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