首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

用delphi写vb调用的dll解决方案

2012-02-12 
用delphi写vb调用的dllvb 中定义接口函数Private Declare Function WimDev_Data Lib WimDev.DLL (ByVal

用delphi写vb调用的dll
vb 中定义接口函数
Private Declare Function WimDev_Data Lib "WimDev.DLL" (ByVal CH As Long, Weight As Long, WtLimit As Long, WtCount As Long, AxisCount As Long, TyreWeight As Long, AxisType As Long, spd As Double) As Long

其中在vb中调用如下:
id0 = WimDev_Data(0, w0, limit0, Cnt0, AxisCnt0, ws0(0), axis0(0), spd0)
定义的变量
Dim w0 As Long, limit0 As Long, Cnt0 As Long, AxisCnt0 As Long, ws0(9) As Long, axis0(9) As Long, spd0 As Double
在调用后能得到数组ws0中所有的数

用delphi写动态库应该怎么定义这个函数,主要是就是怎样能让vb得到数组的数

[解决办法]
无论你用什么语言写dll,希望你都要按标准来写,这样跨语言调用能减少很多错误.
在windows中dll一般参数传递都是stdcall形式,所以用delphi写dll后面最好加上stdcall;
字符类型不要使用delphi里面的string类型,最好使用char数组或是pchar类型;
建议对照delphi和vb的类型,最后不要忘记在dll把函数导出!

热点排行