[fpc-pascal] constref question

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Mar 5 12:24:24 CET 2011


On 05 Mar 2011, at 00:09, José Mejuto wrote:

> Calling test is ok, but if I define test as:
> 
>  MyInterf = interface
>  [....]
>    procedure test(constref param: pmyrec); safecall;
>  end;
> 
> it fails with a sigsegv. Are both expected to have the same behavior
> in this case ? (pointer to record).

"constref" is basically the same as "var" as far as passing the parameter is concerned. That means that in the case above, you are passing a pointer to a pointer to a record. If you just want a pointer to a record, use this:

procedure test(constref param: myrec); safecall;


Jonas


More information about the fpc-pascal mailing list