REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Redefinition of functions from a DLL



You can also redefine a function loaded from a DLL, for example 
REXXUTIL.DLL (see RxFuncDrop for an example for using this technique): 

 
/* example to redefine a function from the DLL REXXUTIL               */

  say "Now calling SysCurPos with (4,5) ..."
  rc = SysCurPos( 4 , 5 )
  say " rc = " || rc

  say "Now calling SysCurPos with (x,y) ..."
  rc = SysCurPos( "x", "y" )
  say " rc = " || rc

exit

                        /* new SysCurPos function                     */
SysCurPos: PROCEDURE
  parse arg p1,p2

                        /* check the type of the parameter            */
  if datatype( p1 ) <> "NUM" | datatype( p2 ) <> "NUM" then
    thisRC = "Invalid parameter!"
  else
  do
                        /* load the original function if not already  */
                        /* loaded                                     */
    if RxFuncQuery( "SysCurPos" ) then
      call RxFuncAdd "SysCurPos", "REXXUTIL", "SysCurPos"

                        /* call the original function                 */
    thisRC = "SYSCURPOS"( p1,p2 )
  end /* else */
RETURN thisRC

  

Inf-HTML End Run - Successful