Posted: 7th Mar 2024 19:58
Hi, I keep getting the following error message when trying to load a plugin, Has anyone any ideas as to why?

" Failed to load plugin 'MyPlugin' required by this app,it may not be available for this platform"

regards Leo

PS The first plugin wrote worked a treat but, after that I just get the same message even with the one that worked first! the plugin is wrote in Delphi 7 and I have the following function

// **** Needed For AGK2 to make plugin work ****
function ReceiveAGKPtr(): Integer; stdcall;
begin
end;
Posted: 7th Mar 2024 20:43
I think u'll get that msg if ur app is 32 bit and the plugin 64 bit or vice versa so make sure those match (we can tick 64 bit builds (or not) in the geany ide).
Posted: 7th Mar 2024 21:15
Thanks Virtual Nomad

I've just ported to Delphi 11 and recompiled the DLL to 64bit, set AGK2 to 64bit too. Still the same message. I am at a lose as what is causing this error.

PS same error on my laptop.

Cheers Leo
Posted: 8th Mar 2024 3:19
Your ReceiveAGKPtr signature doesn't look correct to me.
In C++ it's:
+ Code Snippet
extern "C" DLL_EXPORT void ReceiveAGKPtr( AGKVoidFunc ptr )


Maybe this?
+ Code Snippet
procedure ReceiveAGKPtr(ptr: Integer); stdcall;
begin
  // All of the GetAGKFunction code.
end;
Posted: 8th Mar 2024 20:07
Thanks adambiser !

Doff my cap to you mate, respect!

It was the pointer function, it should have been along these lines below.

// **** Needed For AGK2 to make plugin work ****
function ReceiveAGKPtr(): longint; stdcall;
begin
end;

Although longint is a signed 32bit word it still works, will change this to unsigned longword.

thanks again

Leo
Posted: 9th Mar 2024 1:05
Haven't looked at Delphi in ages, but aren't you declaring ReceiveAGKPtr to be a function that returns a longint? ReceiveAGKPtr doesn't return anything, but receives the pointer...
Posted: 9th Mar 2024 9:43
Yes, the routine will not return anything unless I place a return value like below

function ReceiveAGKPtr(): Pointer; stdcall;
begin
ReceiveAGKPtr:= " A Value to return"
end;

Leo
Posted: 10th Mar 2024 1:57
Let me reword. ReceiveAGKPtr isn't supposed to return anything. It is a void function. Instead, it should receive the pointer as its first argument.