views:

496

answers:

2

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 scripting engine is based on it, I'm hoping it is supported.

A: 

I really doubt it, because Inno implements a subset of Pascal in its script language.

What is the task?

I'd like to implement a plugin framework and would like to register plugins and the backend system to then call the functions passed. Example: RegisterPlugin('Pluginname', @InitPlugin, @InvokePlugin);There are other ways of doing it of course...so not critical.
Maltrap
I think, it's better not to rely on Inno's implementation of Pascal script in this case. You better off with something you have better control over.
+2  A: 

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 uses the PascalScript engine from RemObjects (http://www.remobjects.com/ps.aspx). Maybe you can find some more information there.

Oliver Giesen