Привязка судя по всем у не сделана.
Вообще я имел ввиду вот этот пример:
Код
library Plugin;
uses windows;
type
tInitStruct = packed record
FunctionCount : Cardinal;
FunctionNames : Array of Pchar;
end;
tParamStruct = packed record
WindowHandle : Cardinal; // Handle of workWindow
WindowPID : Cardinal; // pid of process of workWindow
Reserved : Cardinal;
ParamString : Pchar; // string of parameters with substituted variables
ParamStringOrig : Pchar; // original string of parameters
Result : array [0..32767] of char // array for returned values
end;
var
ParamStruct: ^tParamStruct; // init by UOPilot
InitStruct : tInitStruct; // init by plugin, free on unload
function InitPlugin(App, Scr: integer; Var Version: Real):Pointer; stdcall;
// App: Application.Handle of UOPilot
// Scr: reserved
begin
// check UOPilot version, if it needed
if Version >= 2.18 then begin
// exported function count, for UOPilot
InitStruct.FunctionCount := 2;
setlength (InitStruct.FunctionNames, InitStruct.FunctionCount);
// exported function names
InitStruct.FunctionNames[0] := 'Function1';
InitStruct.FunctionNames[1] := 'Function2';
end else
InitStruct.FunctionCount := 0;
// if exported function count = 0, then plugin will be unloaded
Result := @InitStruct;
end;
procedure DonePlugin; stdcall;
begin
// free memory
setlength (InitStruct.FunctionNames, 0);
end;
// exported function example
function Function1(AdressPS: Pointer): boolean; stdcall;
var s :string;
begin
// function has only one parameter, this is Pointer to the tParamStruct structure
ParamStruct := AdressPS;
if ParamStruct^.WindowHandle = 0 then
f:= 'workwindow not defined'
else begin
f:= 'ok, worked' + #9 + 'value, sended to plugin, returned in next element of array';
f:= f + '/n' + ParamStruct^.ParamString;
end;
CopyMemory (@ParamStruct^.Result[0], @f[1], length(f));
// return value not analized while, may be later
Result := true;
end;
function Function2(AdressPS: Pointer): boolean; stdcall;
begin
Result := true;
end;
Exports
InitPlugin,
DonePlugin,
Function1,
Function2;
begin
end.