[fpc-pascal] Problem passing pointers to "hidden" procedure

Ludo Brands ludo.brands at free.fr
Sat Oct 15 09:24:36 CEST 2011

> When the routine being passed as a parameter is in the top 
> level of the unit, "PrPublic", all is well; the expected pointers are 
> passed. When an identical routine "PrPrivate" is hidden inside 
> the top level routine "Test_it", the expected 2nd pointer appears 
> in place of the first and an apparently random pointer appears 
> second.
> What am I doing wrong?

You can't assign private functions to procedural types.
http://www.freepascal.org/docs-html/ref/refse17.html says "A global
procedure or function address". The delphi 6 help is even more explicit:
"Nested procedures and functions (routines declared within other routines)
cannot be used as procedural values."


More information about the fpc-pascal mailing list