Function pointers in Inno Setup
-
19-08-2019 - |
Question
Are function pointers supported in Inno Setup? I can't find anything in the documentation. I know Delphi/Pascal supports them and as the Inno Setup scripting engine is based on it, I'm hoping it is supported.
Solution
I just did a little test and function pointers do work indeed. The following [Code]
section compiles and works just fine:
type
TStrProc = procedure (const AStr: String);
procedure Call(const AProc: TStrProc; const AStr: String);
begin
AProc(AStr);
end;
procedure ShowStr(const AStr: String);
begin
MsgBox(AStr, mbInformation, MB_OK);
end;
function InitializeSetup(): Boolean;
begin
Call(@ShowStr, 'Hello World!');
end;
BTW: Inno Setup uses the Pascal Script engine from RemObjects. Maybe you can find some more information there.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow