Delphi Dll 动态调用例子(2)

http://zhidao.baidu.com/question/157196792.html

delphi动态调用DLL

写了个1.dll内容如下 library Project2; uses SysUtils, Classes; {$R *.res} function abc(x,y:Integer):Integer;stdcall; begin Result:=x+y; end; exports abc; end. 如何动态调用它呢。 比如想实现Edit3.Text:=IntToStr(abc(strtoint...展开
不对啊,调试通了,算不对。
青楼_男子_ | 浏览 6795 次  2010-06-03 16:15
2010-06-03 16:26 最佳答案
 
var
dll:Cardinal;
pp:function(x,y:integer):integer;
begin
dll:=LoadLibrary(PChar('xx.dll'));
if dll<>0 then
begin
@pp:=GetProcAddress(dll, 'abc');
if @pp<>nil then
Edit3.Text:=inttostr(pp(strtoint(Edit1.Text),strtoint(Edit2.text)));
FreeLibrary(dll);
end;
end;
原文地址:https://www.cnblogs.com/westsoft/p/5935725.html