关于dll参数的一个问题。各位大虾帮帮忙了。
我用delphi写了一个dll
其中有个函数是这样的
function aaa(var pst:pchar):integer;stdcall
var str:string
begin
str='ILOVEYOU'
pst:=Pchar(str);//强制转换
showmessage(pst)//显示真确。为ILOVEYOU
result:=1;
end;
我在vb里调用的时候
declare Function aaa Lib "aaa.dll" (ByVal b As String) As Integer
dim b as string;
dim z as integer;
b=space(255);
z=aaa(b)
msgbox b
结果显示的乱ma
z = aaa(b)
结果返回的值