如何把C#中声明的DLL部分的语法改为PB?

路人甲cw 2011-06-07 08:52:58
C#中如下:
[DllImport("libxl.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)]
private static extern IntPtr xlBookAddSheet(IntPtr handle, string name, IntPtr initSheet);
我在PB中这样引用的:
public function ulong addsheet(ulong hwb,string sheetname,ulong sheetid) library "libxl.dll" alias for "xlBookAddSheetA"
但运行时报异常:
Specified argument type differs from required argument type at runtime in DLL function name
"指定的参数类型与动态链接库中的函数所需要的参数类型不一致"

...全文
117 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
pcwe2002 2011-06-08
  • 打赏
  • 举报
回复
这个dll pb没法调用,你看申明CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)
这个调用规则是cdecl,只有stdcall的才行
yyoinge 2011-06-07
  • 打赏
  • 举报
回复
intptr 换成 ref string
或者
global type intptr from structure
ulong attributes
end type

680

社区成员

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

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