home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
vxtech05.zip
/
VXTECH05.TXT
< prev
Wrap
Text File
|
1994-05-20
|
4KB
|
109 lines
============================================================================
VX-REXX Tech Note #5:
Building your own custom PMEXE.EXE
May 19, 1994
Applies to all versions of VX-REXX
----------------------------------------------------------------------------
Eric Giguere
WATCOM International
giguere@watcom.on.ca
============================================================================
Abstract
--------
When VX-REXX builds an executable file from your project (using the
"Make EXE..." menu option), it binds your program to a stub file called
PMEXE.EXE. This tech note and the accompanying code shows you how to
build your own PMEXE.EXE file.
Important Note
--------------
This tech note assumes you have either WATCOM C/C++ 9.5 or higher or
IBM's CSet++ 2.0 or higher and know how to compile files.
PMEXE.EXE's role in life
------------------------
When building an executable, VX-REXX simply takes PMEXE.EXE (found
in your VX-REXX directory) and binds the REXX code and binary window
data to the end of it. PMEXE.EXE doesn't really do much. As shipped
with VX-REXX, this is what it does:
1) Finds and loads the VROBJ.DLL runtime library.
2) Checks to see that the version of VROBJ is at least the
same version as PMEXE.EXE.
3) Calls an entry point in the DLL to get things started.
That's it. By building your own PMEXE.EXE and installing it in
the VX-REXX directory (or using VXREZ 1.1 as described later) you can
modify this behaviour. Why would you? Well, you might want to display
your own splash page, disable the version warnings, register your
own exe-based REXX external functions, and so on.
Building a new PMEXE.EXE
------------------------
Building a new PMEXE.EXE is very simple. Look in the PMEXE directory.
In the H and C subdirectories are the files PMEXE.H and PMEXE.C. These
contain cover functions that do all the dirty work for you. All you
need to do is call them from another C file, such as STUB.C which
has been provided for you to examine. Basically all STUB.C does
is:
-- Calls PMExeLoadDLL to load the DLL
-- Calls PMExeVersion to check the version number
-- Calls PMExeRun to run the VX-REXX program.
Very simple. See the README.TXT for notes on how to build the
PMEXE.EXE from the source. Makefiles have been provided for WATCOM C
and for IBM's CSet. The code has not been optimized to be as small
and efficient as possible, so there are things you can do to simplify
it if you want.
WARNING: If you do register your own external functions, be sure not
to register functions that have the same name as one of the
files in your VX-REXX program, otherwise your program will
refuse to run....
Using the new PMEXE.EXE
-----------------------
To use the new PMEXE.EXE, you can do one of two things:
1. Make a backup copy of the original PMEXE.EXE in your VX-REXX
directory. Copy the new PMEXE.EXE into that directory. Now
every executable you make will use that PMEXE.EXE as its
stub.
2. Get and install VXREZ 1.1, a set of VX-REXX macros that let
you bind resources to your VX-REXX executables. (It is available
the same place you got this tech note from.) This version of
VXREZ has a new feature: if it sees a PMEXE.EXE in the same
directory as your project's .VRP file, it will bind the resources
to it and use it as the stub file instead of VX-REXX's own
PMEXE.EXE. (Note that if you created a PMEXE.EXE with resources
already bound to it, the resource compiler will first strip
off these resources before binding the new ones.)
That's it! Have fun....
Sample Code
-----------
There are two subdirectories with sample code. The PMEXE subdirectory
builds a simple PMEXE.EXE much like the one that comes with VX-REXX 2.0.
The SCAT subdirectory builds a version of PMEXE.EXE that registers
a new external function that the VX-REXX program then uses.