[fpc-pascal] Problem passing pointers to "hidden" procedure
Sven Barth
pascaldragon at googlemail.com
Sat Oct 15 23:03:24 CEST 2011
On 15.10.2011 01:01, andrew.bennett at ns.sympatico.ca wrote:
> As part of an attempt at multi-threading, I have had to move
> many things that used to be global into the Implementation
> parts of units in order to enforce privacy. When I moved a
> routine passed as a parameter and put it inside the routine
> to be threaded, the program ceased to work. I append the
> essential code abstracted from my program:
>
[snip]
> What am I doing wrong?
As Ludo wrote local procedures/functions are not supposed to be passed
around as function pointers. In trunk and the upcoming 2.6 there is a
possibilty though: nested procedure variables.
For a description you can take a look at this commit message:
http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&revision=15694
Especially take a look at the tests in tests/test/tmaclocalprocparam*
mentioned in the commit log for examples of this feature.
Regards,
Sven
More information about the fpc-pascal
mailing list