Why do I get access violation exceptions if I try to initialize function references with
var xxx = @reference
Exception in Script: Runtime error: "Access violation" at line 31, column 23
If I manually initialize it it works fine.
Code:program new; function realfunction() : boolean; begin result := true end; type trec = record callthis : function:boolean; end; var noinit : function:boolean; norec : function:boolean = @realfunction; onerec : trec = [@realfunction]; funcarr : array[0..0] of trec = [[@realfunction]]; b : boolean; begin noinit := @realfunction; noinit(); writeln(b); try b := norec(); writeln(b); except writeln('got access violation'); end; try b := onerec.callthis(); writeln(b); except writeln('got access violation'); end; try with funcarr[0] do b := callthis(); writeln(b); except writeln('got access violation'); end; end.Code:False got access violation got access violation got access violation Successfully executed.







Reply With Quote








