为VFP编写的DLL传递参数不对
编号:QA001825
建立日期: 1999年10月6日 最后修改日期:1999年10月6日
所属类别:
周万宝:
Delphi4.0 & Visual FoxPro6.0
Windows98
我在Delphi中编制一DLL,想在FOXPRO中调用:
在Delphi中定义两个export函数:
setcaption(S:PChar);
begin
Form1.label1.Caption:=String(S);
end;
getcaption:PChar;
begin
Result:=PChar(Form1.label1Caption)
end;
在FoxPro中调时用getcaption完全可获得其返回的值,而用setcaption时传递过去的却是空值,不知为何?在FoxPro中我是这样注册两函数的:
DECLARE setcaption IN xxx.dll String S
DECLARE String getcaption IN xxx.dll
回答:
问题出在Delphi方面。VFP规定其调用的DLL函数必须采用stdcall方式。这对于没有参数的函数不产生影响,但对于你的setcaption产生影响。你应该修改定义为:
procedure setcaption(S:PChar);stdcall;
begin
......
end;
此问题由李海回答。
| |
|
|
| |
|
|