VB调用DELPHI写的dll出现很奇怪的问题,请高人相助啊 !!!(70分)

  • 主题发起人 主题发起人 mazheng
  • 开始时间 开始时间
M

mazheng

Unregistered / Unconfirmed
GUEST, unregistred user!
VB调用DELPHI写的dll出现很奇怪的问题,请高人相助啊 !!!

我有个delphi座的 Dll,里面有个窗体,源码客户没有给。
在delphi里调用为
//声明--------------------------------------------------------
function RunMyDllcurv(dbuf:array of single
dlen:integer):integer;stdcall;external 'Pdllcurv' index 1;
//调用--------------------------------------------------------
procedure TForm_demo.Button4Click(Sender: TObject);//调用正常
var
curvlen:integer;
curvdata:array[0..99999] of single;
begin
curvlen:=100000
RunMyDllcurv(curvdata, curvlen) ;
end;

//************************************************************

在VB里调用为
//声明--------------------------------------------------------
Private Declare Function RunMyDllcurv Lib "Pdllcurv.dll&quot
(dbuf As Single, ByVal dleen As Long) As Long
//调用--------------------------------------------------------
Private Sub Command1_Click()//调用不正常
Dim buff(99999) As Single

Call RunMyDllcurv(buff(1), 100000)

End Sub

具体表现为:
1。
当 Pdllcurv.dll 在 vb 系统目录里时, 调式时,按下 Command1 按钮
后, dil 里的窗体可以正常显示,但关闭该窗体后,会出现一个“dll 调用约定错误”的错误
2.
当 生成exe文件后 把 Pdllcurv.dll 放在exe文件所在目录里,按下 Command1 按钮
后,dil 里的窗体没有显示,却出现“读取内搓错误”消息条。
 
试试

Private Declare Function Pdllcurv Lib "Pdllcurv.dll&quot
(dbuf As Single, ByVal dleen As Long) As Long
//调用--------------------------------------------------------
Private Sub Command1_Click()//调用不正常
Dim buff(99999) As Single

Call Pdllcurv(buff(1), 100000)

End Sub
 
第一个参数是数组啊,
Private Declare Function RunMyDllcurv Lib "Pdllcurv.dll&quot
(ByRef dbuf() As Single, ByVal dleen As Long) As Long
//调用--------------------------------------------------------
Private Sub Command1_Click()//调用不正常
Dim buff(99999) As Single

Call RunMyDllcurv(buff,100000)

End Sub
 
to feverkim
我照你说的去做,vb就死掉............
 
第一个参数是数组啊,
Private Declare Function RunMyDllcurv Lib "Pdllcurv.dll&quot
(ByRef dbuf() As Single, ByVal dleen As Long) As Long
//调用--------------------------------------------------------
Private Sub Command1_Click()//调用不正常
Dim buff(99999) As Single

Call RunMyDllcurv(buff(1),100000)
//这里改改,
End Sub


呵呵,这个如果不行的话,就郁闷了,
 
Call RunMyDllcurv(buff,100000) 不行啊
 
晕,第一个参数是数组,所以需要传递指针啊
 
vb 没有指针的
 
vb里没有指针
 
有誰寫過,vb調用delphi寫的*.dll 傳入字符返回字符成功的例子,
測試了好多次都失敗了, 好痛苦??
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
759
import
I
后退
顶部