H
hawii
Unregistered / Unconfirmed
GUEST, unregistred user!
为什么写个简单的例子也会出错?<br>运行就出‘Access violation at address 003820A1 in module 'MyDll.dll'’. Read of address 00000000 的错阿?<br>达人们帮忙看看。<br><br>//Mydll.dpr文件内容<br>function mSwap(var a,b:Integer): integer;stdcall;export;<br>var<br> c:Integer;<br>begin<br> c:=a;a:=b;b:=a;<br> Result:=1;<br>end;<br>exports<br> mSwap;<br><br>//调用模块内容。<br> function mSwap(var a,b:Integer):Integer;external 'MyDll.dll'<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> a,b:Integer;<br>begin<br> a:=SpinEdit1.Value ;<br> b:=SpinEdit2.Value ;<br> mSwap(a,b);<br> SpinEdit1.Value :=a;<br> SpinEdit2.Value :=b;<br>end;