exe也可以当Dll用

function abcd(x: integer): integer; stdcall;    
var    
  Form1: TForm1;    
implementation    
    
function abcd(x: integer): Integer; stdcall;    
begin    
  Result := x * 2;    
end;    
{$R *.dfm}    
exports    
  abcd;    
    
var    
  abcd:function(x:integer):Integer;stdcall;    
  H: THandle;    
begin    
  h := LoadLibrary('exeDllTest.exe');    
  if H > 32 then    
  begin    
    @abcd := GetProcAddress(h, 'abcd');    
    ShowMessage(inttostr(abcd(8)));    
  end;    
  FreeLibrary(h);    
end;    
 

你可能感兴趣的:(exe也可以当Dll用)