[fpc-pascal] how to pass a procedure address and execute it?

waldo kitty wkitty42 at windstream.net
Thu Jan 23 23:41:26 CET 2014


On 1/23/2014 2:27 PM, Marco van de Voort wrote:
> In our previous episode, waldo kitty said:
>>
>> i'm trying to use one routine (centralControl) to process data from two
>> different routines (inputThis and outputThat)... the one routine
>> (centralControl) needs to call one of two other routines
>
> whichproc is typeless and thus roughly equal to a pointer to a
> byte (though semantically different, and add another pointer indirection for
> the VAR). So the compiler doesn't know what to do with it.
>
>> how? :(
>
> Define a procedure type that matches both procedures, in your example
>
> Type
>    TProc = procedure ; // which is predefined in system afaik.
>
> and change whichproc to that type. The VAR is not necessary in this case.

excellent! as noted in a previous post, i was so close several times ;)

-- 
NOTE: No off-list assistance is given without prior approval.
       Please keep mailing list traffic on the list unless
       private contact is specifically requested and granted.



More information about the fpc-pascal mailing list