This answer is not recommended using Inno Setup 6. See My answer for an updated solution.
There is no way to refuse to use the InnoCallback wrapper library, since you simply cannot define the callback procedure of the calling convention of your choice in the Inno installer, nor can you define the callback function with the register call of the convention (one is specific to the Delphi compiler) in your c # library.
Because of this limitation, you must use an external library that wraps the callback method from Inno Setup into a function with a calling convention that your library can use (InnoCallback uses stdcall for this).
So what you ask would be possible if you are writing your library in a language that supports Delphi register calling conventions. Out of curiosity, in Delphi you can write, for example:
library MyLib; type TMyCallback = procedure(IntParam: Integer; StrParam: WideString) of object; procedure CallMeBack(Callback: TMyCallback); stdcall; begin Callback(123, 'Hello!'); end; exports CallMeBack; begin end.
And then in Inno Setup (without any wrapper library):
[Setup] AppName=My Program AppVersion=1.5 DefaultDirName={pf}\My Program [Files] Source: "MyLib.dll"; Flags: dontcopy
[Code] type TMyCallback = procedure(IntParam: Integer; StrParam: WideString); procedure CallMeBack(Callback: TMyCallback); external ' CallMeBack@files :mylib.dll stdcall'; procedure MyCallback(IntParam: Integer; StrParam: WideString); begin MsgBox(Format('IntParam: %d; StrParam: %s', [IntParam, StrParam]), mbInformation, MB_OK); end; procedure InitializeWizard; begin CallMeBack(@MyCallback); end;
TLama source share