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

leledumbo leledumbo_cool at yahoo.co.id
Sat Jan 25 02:10:55 CET 2014


> ahhh! that helps to explain what the compiler error was that i was
seeing... so 
i may need two different types if each procedure called from centralControl
has 
different parameters? won't that cause a conflict if the parameters are not
the 
same or are in different ordering or even if some procedure doesn't have 
parameters at all? 

Yes, of course. If you want to implement something like callback, the
parameters have to be consistent. You can't pass arbitrary procedure as it
would violate the type safe property. One idea would be to have all possible
procedures implement the same parameter list, but only use some of them in
the implementation. This could slow down the processing a bit but if speed
is not really an issue I don't think you should care.



--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/how-to-pass-a-procedure-address-and-execute-it-tp5718103p5718117.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.



More information about the fpc-pascal mailing list