procedure TForm1.Button1Click(Sender: TObject); <br>type <br>TIntFunc=function(i:integer):integer;stdcall; <br>var <br>Th:Thandle; <br>Tf:TIntFunc; <br>Tp:TFarProc; <br>begin <br>Th:=LoadLibrary(’Cpp.dll’); {装载DLL} <br>if Th>0 then <br>try <br>Tp:=GetProcAddress(Th,PChar(’TestC’)); <br>if Tp<>nil <br>then begin <br>Tf:=TIntFunc(Tp); <br>Edit1.Text:=IntToStr(Tf(1)); {调用TestC函数} <br>end <br>else <br>ShowMessage(’TestC函数没有找到’); <br>finally <br>FreeLibrary(Th); {释放DLL} <br>end <br>else <br>ShowMessage(’Cpp.dll没有找到’); <br>end;