Skip to content

Instantly share code, notes, and snippets.

@rwilkes
Forked from seraphy/functionptr.iss
Created April 26, 2018 02:00
Show Gist options
  • Save rwilkes/817d81e325d0940b5c0f80cf1702cf0e to your computer and use it in GitHub Desktop.
Save rwilkes/817d81e325d0940b5c0f80cf1702cf0e to your computer and use it in GitHub Desktop.
Inno Scriptで関数ポインタを使う方法
[Code]
type
Tproc = procedure(const msg: String);
Tfunc = function(const value: Integer): String;
procedure sample_proc(const msg: String);
begin
Log(msg);
end;
function sample_func(const value: Integer): String;
begin
Result := IntToStr(value);
end;
procedure sample;
var
proc_ptr: Tproc;
func_ptr: Tfunc;
begin
proc_ptr := @sample_proc;
func_ptr := @sample_func;
proc_ptr(func_ptr(123));
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment