home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rex22emx.zip / demo / dynfunc.rexx < prev    next >
OS/2 REXX Batch file  |  2000-06-26  |  2KB  |  58 lines

  1. #! /local/bin/rexx
  2. /*
  3.  * Test program for Regina 08e
  4.  *
  5.  * This program demonstrates the loading of two dynamic/shared
  6.  * libraries of external functions.
  7.  *
  8.  * Assumes that the dynamic/shared libraries have been built
  9.  * and are in the current directory or in a directory specified
  10.  * by the environment variable appropriate to the Operating System
  11.  * eg. LD_LIBRARY_PATH under Unix, LIBPATH under OS/2.
  12.  *
  13.  * There is one external function in each of the dynamic libraries.
  14.  * All this function does is displays each of the parameters passed
  15.  * to it, plus the name of the dynamic library.
  16.  */
  17. Trace o
  18. Parse Source platform .
  19.  
  20. Call Rxfuncadd 'Test1LoadFuncs','test1','Test1LoadFuncs'
  21. Call Rxfuncadd 'Test2LoadFuncs','test2','Test2LoadFuncs'
  22.  
  23. /*
  24.  * With these variables set here, they are lost as a result
  25.  * of Test?LoadFuncs()
  26.  */
  27. parm1 = 'Param1'
  28. parm2 = 'Param2'
  29.  
  30. If Test1LoadFuncs() \= 0 Then Abort("Calling Test1LoadFuncs")
  31. If Test2LoadFuncs() \= 0 Then Abort("Calling Test2LoadFuncs")
  32.  
  33. /*
  34.  * With these variables set here, everything works correctly.
  35.  *
  36. parm1 = 'Param1'
  37. parm2 = 'Param2'
  38.  */
  39.  
  40. If Test1Function1('Test1Function1',parm1) \= 0 Then
  41.    Abort("Calling Test1Function1")
  42.  
  43. If Test2Function1('Test2Function1',parm1) \= 0 Then
  44.    Abort("Calling Test2Function1")
  45.  
  46. If Test1Function2('Test1Function2',parm1,parm2) \= 0 Then
  47.    Abort("Calling Test1Function2")
  48.  
  49. If Test2Function2('Test2Function2',parm1,parm2) \= 0 Then
  50.    Abort("Calling Test2Function2")
  51.  
  52. return 0
  53.  
  54. Abort: Procedure
  55. Parse Arg mesg
  56. Say "Error trapped:" mesg
  57. Exit 1
  58.