home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxtech05.zip / VXTECH05.TXT < prev   
Text File  |  1994-05-20  |  4KB  |  109 lines

  1. ============================================================================
  2.  VX-REXX Tech Note #5:
  3.                                          Building your own custom PMEXE.EXE
  4.  
  5.                                                                May 19, 1994
  6.  
  7.                                          Applies to all versions of VX-REXX
  8.                      
  9. ----------------------------------------------------------------------------
  10.  
  11.                                                        Eric Giguere
  12.                                                        WATCOM International
  13.                                                        giguere@watcom.on.ca
  14.  
  15. ============================================================================
  16.  
  17. Abstract
  18. --------
  19.  
  20. When VX-REXX builds an executable file from your project (using the
  21. "Make EXE..." menu option), it binds your program to a stub file called
  22. PMEXE.EXE.  This tech note and the accompanying code shows you how to
  23. build your own PMEXE.EXE file.
  24.  
  25.  
  26. Important Note
  27. --------------
  28.  
  29. This tech note assumes you have either WATCOM C/C++ 9.5 or higher or
  30. IBM's CSet++ 2.0 or higher and know how to compile files.
  31.  
  32.  
  33. PMEXE.EXE's role in life
  34. ------------------------
  35.  
  36. When building an executable, VX-REXX simply takes PMEXE.EXE (found
  37. in your VX-REXX directory) and binds the REXX code and binary window
  38. data to the end of it.  PMEXE.EXE doesn't really do much.  As shipped
  39. with VX-REXX, this is what it does:
  40.  
  41.       1) Finds and loads the VROBJ.DLL runtime library.
  42.       2) Checks to see that the version of VROBJ is at least the
  43.          same version as PMEXE.EXE.
  44.       3) Calls an entry point in the DLL to get things started.
  45.  
  46. That's it.  By building your own PMEXE.EXE and installing it in
  47. the VX-REXX directory (or using VXREZ 1.1 as described later) you can
  48. modify this behaviour.  Why would you?  Well, you might want to display
  49. your own splash page, disable the version warnings, register your
  50. own exe-based REXX external functions, and so on.
  51.  
  52.  
  53. Building a new PMEXE.EXE
  54. ------------------------
  55.  
  56. Building a new PMEXE.EXE is very simple.  Look in the PMEXE directory.
  57. In the H and C subdirectories are the files PMEXE.H and PMEXE.C.  These
  58. contain cover functions that do all the dirty work for you.  All you
  59. need to do is call them from another C file, such as STUB.C which
  60. has been provided for you to examine.  Basically all STUB.C does
  61. is:
  62.  
  63.        -- Calls PMExeLoadDLL to load the DLL
  64.        -- Calls PMExeVersion to check the version number
  65.        -- Calls PMExeRun to run the VX-REXX program.
  66.  
  67. Very simple.  See the README.TXT for notes on how to build the
  68. PMEXE.EXE from the source.  Makefiles have been provided for WATCOM C
  69. and for IBM's CSet.  The code has not been optimized to be as small
  70. and efficient as possible, so there are things you can do to simplify
  71. it if you want.
  72.  
  73. WARNING:  If you do register your own external functions, be sure not
  74.           to register functions that have the same name as one of the
  75.           files in your VX-REXX program, otherwise your program will
  76.           refuse to run....
  77.  
  78.  
  79. Using the new PMEXE.EXE
  80. -----------------------
  81.  
  82. To use the new PMEXE.EXE, you can do one of two things:
  83.  
  84.    1. Make a backup copy of the original PMEXE.EXE in your VX-REXX
  85.       directory.  Copy the new PMEXE.EXE into that directory.  Now
  86.       every executable you make will use that PMEXE.EXE as its
  87.       stub.
  88.  
  89.    2. Get and install VXREZ 1.1, a set of VX-REXX macros that let
  90.       you bind resources to your VX-REXX executables.  (It is available
  91.       the same place you got this tech note from.)  This version of
  92.       VXREZ has a new feature:  if it sees a PMEXE.EXE in the same
  93.       directory as your project's .VRP file, it will bind the resources
  94.       to it and use it as the stub file instead of VX-REXX's own
  95.       PMEXE.EXE.  (Note that if you created a PMEXE.EXE with resources
  96.       already bound to it, the resource compiler will first strip
  97.       off these resources before binding the new ones.)
  98.  
  99. That's it! Have fun....
  100.  
  101.  
  102. Sample Code
  103. -----------
  104.  
  105. There are two subdirectories with sample code.  The PMEXE subdirectory
  106. builds a simple PMEXE.EXE much like the one that comes with VX-REXX 2.0.
  107. The SCAT subdirectory builds a version of PMEXE.EXE that registers
  108. a new external function that the VX-REXX program then uses.
  109.