Yeah, that worked for me too, but unfortunately it did not worked in my real case. My example program was incomplete. This was more like what i wanted to accomplish:
program x;
type
TProc = procedure; cdecl;
TKecske = function (a: integer): integer; cdecl;
PPointer = ^Pointer;
var Func: TProc;
function kecske(a: integer): integer; cdecl;
begin
kecske := a + 8;
end;
const
pKecske: Pointer = @kecske;
pFunc: Pointer = @Func;
procedure set_it1(src: Pointer; dst: PPointer);
begin
dst^ := src;
end;
begin
set_it1(pKecske, @pFunc);
WriteLn(TKecske(pFunc)(8));
end.
But in the meantime, i figured it out, the catch was casting the pointer to ppointer. Thanks for helping.