steve@cad0 (Stephen Peter) (02/21/91)
In article <26067@adm.brl.mil> JBERTELO%RKC.UFSIA.AC.BE@cunyvm.cuny.edu ( Johan Berteloot) writes: >If have a very specific question : How can one activite a procedure, of which >only the address is known in a pointer ? Any answer is welcome. > >--Johan Berteloot JBERTELO@BANUFS11.BITNET There was also a similar request for info in article <30527@usc> From: ajayshah@almaak.usc.edu (Ajay Shah) The following program passes the address of procedure a and function b, to the procedure call; it seems to work OK, but may screw-up the stack because the function return is being ignored. (I don't know how to retreive the function return. I think it may be in the AX register ?? but havent looked :-) {_________________________________________________________} program testit; { test passing a procedure/function as a parameter stephen peter feb 1991 } procedure a; begin writeln ('hello there') end; function b : double; begin writeln ('G''Day'); b := 43 end; procedure call (p : pointer); var proc : procedure; begin if p = nil then exit; @proc := p; proc; end; begin call (@a); call (@b); end. {_________________________________________________________} hope that helps! Remember to compile it with the "Force FAR calls" ON. Stephen Peter steve@cad0.arch.unsw.oz.au School of Architecture, University of New South Wales, Australia.