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

waldo kitty wkitty42 at windstream.net
Thu Jan 23 23:38:44 CET 2014


On 1/23/2014 2:22 PM, Ewald wrote:
>
> On 23 Jan 2014, at 20:18, waldo kitty wrote:
>
>>
>> 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 (doThis or doThat)...
>> how? :(
>>
>
> First define a type to make your like easier:
> Type
> 	TProcType: Procedure;
>
> Next, adjust contralContol's prototype: procedure centralControl(var aValue : word; theRecord : somerec; whichProc: TProcType);
>
> And you're done:-)

damn! i was so close so many times! i did try using "pointer" as the type with 
and without 'var' for whichProc... this will be a huge savings in time and code 
size! thanks!

-- 
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