Rexx/Wrapper

Rexx/Wrapper

Version 2.3

23 May 2004


Introduction

Rexx/Wrapper is a tool that wraps Rexx source or tokenised code into an executable program. The Rexx source code can be optionally compressed and encoded to ensure that the original Rexx code cannot be viewed (unless you have the original encryption key).

Note that Rexx/Wrapper is NOT a compiler; the executable program still requires a Rexx interpreter to execute the program.

Getting Started

The first time you run Rexx/Wrapper you should display the help information. To do this run the rexxwrap.cmd program with your Rexx interpreter; eg.
rexx rexxwrap.cmd -h

-h, -?, and -help can all be specified to display help.

Requirements

To use Rexx/Wrapper you need two extra bits of software:
  1. A supported Rexx interpreter
  2. A supported C compiler
The Rexx interpreter that is linked with the executable must be capable of executing an instore Rexx macro via the SAA API. The Rexx interpreter used to build the executable wrapper can be different to the interpreter used to run the executable program. If wrapping tokenised code, then the Rexx interpreter that creates the tokenised code, must be the same interpreter that runs the tokenised code.

All suppliers of Rexx interpreters provide access to their interpreter via a shared or dynamic library. This means that it is not possible to build a completely stand-alone executable; you will always have to include the shared or dynamic library with the executable built with Rexx/Wrapper.

There is one exception to this rule; Regina. Regina also provides a static library, which means you can link your program with Regina's static library, and you will get a completely stand-alone executable.

There is a catch however with using the Regina static library :-(. The Rexx program that you wrap, cannot dynamically load an external function package. This is because the Regina static library does not (and cannot) support the dynamic loading of external functions. External functions, by their very nature, require the presence of a dynamic or shared library to operate.

Rexx/Wrapper requires a C compilers that supports ANSI prototypes. It will not work with older K&R C Compilers.

For a list of the supported C compilers for the current platform, run rexxwrap.cmd with the -h.

Modes of Operation

Rexx/Wrapper can be run in one of 3 ways.

Interactive

To run Rexx/Wrapper interactively, simply run the rexxwrap.cmd program with your Rexx interpreter; eg.
rexx rexxwrap.cmd

You will then be prompted for several pieces of information that Rexx/Wrapper needs to build the executable program. The equivalent command-line switch is included below in parentheses. To set a value to an empty value, enter a dash at the prompt.

Command line

To run Rexx/Wrapper from the command line (not really recommended) you supply all options on the Operating System command line. The options are defined above, and consist of the option concatenated with an equals sign concatenated with the option value. eg
rexx rexxwrap.cmd -encrypt=yes -intlib=..\rexx\rexx.lib ...

Defaults

This mode of operation assumes you have already run Rexx/Wrapper at least once and want to use the values you supplied the last time Rexx/Wrapper was run. You also must be running Rexx/Wrapper in the same directory you last ran it. To run with default values, supply the simgle option -d on the command line. Rexx/Wrapper will read the values specified in the rexxwrap.prm file in the current directory. This file consists of a number of Rexx statements, that set compound variables, which are interpreted.

You can also supply a filename to the -d switch to specify the file containing the Rexx/Wrapper parameters to use.

Sample session

An example session using the prompt method and REXX/imc is shown below. User entered values are displayed in bold.

This is Rexx/Wrapper 2.0 - 18 July 2002
---------------------------------------
Program Name(-program) [] rexxcps
Rexx filename(-rexxfiles) [] ../rexx/demo/rexxcps.rexx
Rexx interpreter(-interpreter) [] rexximc
Compiler(-compiler) [] gcc
Rexx Interpreter Library(-intlib) [] /tmp/rexx-imc-1.7/librexx.so
Rexx Interpreter Header File Directory(-intincdir) [] /tmp/rexx-imc-1.7
Rexx/Wrapper Source Directory(-srcdir) [] ..
Encrypt source: yes/no(-encrypt) [] yes
Compress source: yes/no(-compress) [] no
Use tokenised code rather than source: yes/no(-token) [] no
Call Rexx program as subroutine: yes/no(-subroutine) [] no
Running configure script...
creating cache ./config.cache
updating cache ./config.cache
creating ./config.status
creating configur
creating config.h
Compiling DES modules...rand_key set_key str2key ecb_enc cbc_cksm des_enc
Compiling intbuild.c...
Linking intbuild...
Running intbuild to produce rexxcps.c...
The generated key for this program is: tlxNhsju
If you need to dump the original code from the rexxcps executable, run:
rexxcps '--key=tlxNhsju'
Compiling rexxcps.c...
Linking rexxcps
Done!

The following example session uses the default method and Rexx/Trans (under Win32). User entered values read from the rexxwrap.prm file are displayed in bold.

This is Rexx/Wrapper 2.0 - 18 July 2002
---------------------------------------
Program Name(-program) [aces]
Rexx filename(-rexxfiles) [d:\rexxtk\demo\aces.rexx]
Rexx interpreter(-interpreter) [rexxtrans]
Compiler(-compiler) [vc]
Rexx Interpreter Library(-intlib) [d:\rexxtrans\rexxtrans.lib]
Rexx Interpreter Header File Directory(-intincdir) [d:\rexxtrans]
Rexx/Wrapper Source Directory(-srcdir) [d:\rexxwrapper]
Encrypt source: yes/no(-encrypt) [no]
Compress source: yes/no(-compress) [no]
Use tokenised code rather than source: yes/no(-token) [no]
Call Rexx program as subroutine: yes/no(-subroutine) [no]
Do you want to build a GUI version: yes/no(-win32gui) [yes]
Do you want a console window if required: yes/no(-guiconsole) [yes]
Do you want to specify versioning information and add an icon to the executable: yes/no(-resource) [yes]
Program version. eg 2.0.1(-version) [1.0]
Program description(-desc) [Aces Card Game]
License(-license) [LGPL]
Icon filename(-icon) [d:\\rexxtk\\demo\\aces.ico]
Compiling intbuild.c...
intbuild.c
Linking intbuild...
Running intbuild to produce aces.c...
If you need to dump the original code from the aces executable, run:
aces --key=1
Compiling aces.c...
aces.c
Linking aces
Done!

Other uses of the tokenised file

If you run Rexx/Wrapper and request that tokenised code be generated for your program, you have another option when it comes to running your program. In this mode. Rexx/Wrapper creates an executable progam called rexxtok or rexxtok.exe. This program can be run independently of the rexxwrap.cmd program, and can create or execute tokenised Rexx code.
To generate a file of tokeinsed Rexx code, run rexxtok with the following options:
eg.
rexxtok -srexxcps.rexx -trexxcps.tok
To execute the tokenised Rexx code, run rexxtok with the following options: eg.
rexxtok -x -trexxcps.tok

Getting at the original program

When Rexx/Wrapper runs, it will display details on how to extract the source code (or tokenised code) from the executable Rexx/Wrapper built. Essentially, this involves running the generated executable program with the --key=key value option. Assuming you created an executable called rexxcps, and you did not request encryption of the Rexx code or tokenised code:
rexxcps --key=1

will display the original source code. The encryption code generated by Rexx/Wrapper will be displayed during the building phase, so make a note of it. If you asked for tokensed code, then the executable will still dump out the tokenised code, but it won't make much sense, or be much use.

Supported C compilers

Rexx/Wrapper supports the following C compilers:

Platform Compiler Location Status
Unix GNU C http://gcc.gnu.org/ Free
cc, c89, xlc,... Various Commercial ANSI Compilers Commercial
OS/2 EMX ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu/emx+gcc/
ftp://ftp-os2.cdrom.com/pub/os2/emx09d/
Free
Open Watcom http://www.openwatcom.org/ Free
DOS - VCPI EMX - OS/2 hosted ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu/emx+gcc/
ftp://ftp-os2.cdrom.com/pub/os2/emx09d/
Free
DOS - DPMI DJGPP http://delorie.com/djgpp/ Free
Win32 Cygnus Win32 http://www.cygwin.com/ Free
MinGW http://www.mingw.org Free
lcc-win32 http://www.mingw.org Free
Borland C++ 5.5 http://www.borland.com/bcppbuilder/freecompiler/ Free
Open Watcom http://www.openwatcom.org/ Free
Microsoft C++ 5.0+ http://www.microsoft.com Commercial
Watcom C++ 10.6+
Commercial
QNX Watcom C++ 10.6
Commercial

Acknowlegements

All compression code in the zlib directory is Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler.
All encryption code in the des directory is Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com).

Copyright © Mark Hessling 1999-2004 <M.Hessling@qut.edu.au>

Last updated 23 May 2004