At the moment I can use the procedure in SCAR.
But i'm having trouble calling a procedure that is in SCAR from the plugin.
Example.
program test;
procedure NewThreadLoop;
var
i: Integer;
begin
for i := 0 to 9 do
WriteLn(i);
end;
procedure Loop;
var
i: Integer;
begin
for i := 0 to 9 do
WriteLn(i);
end;
begin
CreateThread('NewThreadLoop'); // Call 'NewThreadLoop' on new thread.
Loop; // Should occur at, roughly, the same time as 'NewThreadLoop'.
end;
Right not I just have the CreateThread procedure in the plugin outputting "Text" to the debug box…
library The_Scripts_Plugin;
uses
FastShareMem,
SCARFunctions,
SysUtils,
Classes;
{$R *.res}
procedure CreateThread(ProcedureName: string); stdcall;
begin
WriteLn('Test');
end;
function GetFunctionCount: Integer; stdcall; export;
begin
Result := 1;
end;
function GetFunctionInfo(x: Integer; var ProcAddr: Pointer; var ProcDef: PChar): Integer; stdcall;
begin
case x of
0:
begin
ProcAddr := @CreateThread;
StrPCopy(ProcDef, 'procedure CreateThread(ProcedureName: string);');
end;
else
x := -1;
end;
Result := x;
end;
exports GetFunctionCount;
exports GetFunctionInfo;
begin
end.
Now I am stuck… Because I need to somehow be able to call 'NewThreadLoop' from within the plugin.
Unfortunately doing the following does not work…
procedure CreateThread(ProcedureName: string); stdcall;
begin
NewThreadLoop;
end;
I read over the file you mentioned, and I believe it just shows how I can call functions/procedure from scar. But I need to be able to call functions/procedure from SCAR in the plugin (The complete opposite).
The whole idea of this plugin is making me look something like this -> :confused: