2011-10-11 243 views

回答

2

這裏是SEM的使用「late'binding裝載的DELPHI例如:

Var 
     DLLhandle : THandle; 

Function SEM_Load(sStatemachineFilename : String) : Byte; 
var 
    Foo: function (filename : PChar) : Byte; {$IFDEF WIN32} stdcall; {$ENDIF} 
    ProcAddres : farproc; 
    cc: Byte; 
begin 
    ProcAddres := GetProcAddress(DLLhandle, 'SEM_Load'); 
    If @ProcAddres <> NIL then 
    Begin 
     Foo := ProcAddres; 
     cc := Foo(Pchar(sStatemachineFilename)); 
    End; 
    Result := cc; 
end;