# How to use YACL with EMX C++ for OS/2

Last update: June 20th, 1997

This file provides directions on how to build YACL and its demo programs using EMX C++ for OS/2.

Requirements: EMX C++ version 2.6.1 or later, and a decent make program. I recomment GNU make version 3.72.1. The emx makefiles included with YACL are designed for GNU make version 3.72 or better. I have heard that they will not work with earlier versions of GNU make. You can get the latest version of GNU make from `ftp-os2.nmsu.edu` by anonymous ftp.

Caveat: YACL will not build properly with the 2.7.0 and 2.7.1 versions of EMX: a bug in the GNU C++ compiler causes an internal compiler error while compiling YACL. However, YACL works fine with version 2.6.3 and with version 2.7.2.

## Building YACL

Here are the steps:

0. Create and change into the directory you want to install YACL in. For example, in an OS/2 command window:

`md c:\yacl c: cd \yacl`

1. Unzip the file YACL0160.ZIP, preserving directories. For example:

`unzip yacl0160.zip`

or, if you use pkunzip:

`pkunzip -d yacl0160.zip`

2. Set the environment variable `YACLPATH` to point to the directory in which yacl was unzipped, e.g.,

`set YACLPATH=c:\yacl`

3. Modify the control file `control/emxos2.ctl`. In that file:

(a) Set the variable `EMXPATH` to point to the bin directory of the compiler. Its default setting in that file is `d:\emx\bin`.

(b) Set the variable `IOSTREAM` to either `iostream` or `stdcpp` depending on whether your EMX version is 2.6.3 (or earlier) or 2.7.2 (or later).

4. Build the libraries. CD into the directory you chose in step 0 and issue the make command in an OS/2 command window:

`make -f emxos2.mak`

5. Poke around in the directory structure under basedemo and uidemo; build and try out the programs there using the make files provided. Each directory in uidemo and almost every directory in basedemo contains an EMX-specific makefile named emxos2.mak which can be used for building the demo. I have provided makefiles for most of the base demos but not all because most, if not all, the base classes are heavily used in the UI classes.

Using gdb with YACL:

You can use gdb with programs that use YACL. To do this, you must build the YACL libraries using the makefiles named emxdebug.mak instead of emxos2.mak. Specifically, use the command line

`make -f emxdebug.mak DEBUG="-g -DDEBUG"`

This will create library files base.a, io.a and ui.a instead of the corresponding .lib versions. If you then use emxdebug.mak in any of the UI demo directories, you'll get an executable that can be debugged with emx gdb. Bear in mind, however, that the resulting executables are significantly larger than the ones built using the emxos2.mak makefiles.

## Known problems

YACL will not compile under version 2.7.0 of EMX. The compiler crashes with an internal compiler error. Version 2.6.3 works fine, however, as does version 2.7.2.

Under OS/2, this compiler produces very compact executables; the UI demos are in the range of 300K. The only compiler that does better is Watcom.

There seems to be a connection (at least on my machine) between the speed of the EMX compiler and the IBM Internet Access Kit package that came with the BonusPak (don't ask me why). If I have the SLIP drivers from the IAK package loaded, EMX slows to a crawl: I clocked it taking six hours to compile all the ui classes on my 486/66 with 28 MB main memory. But if I don't have the IAK loaded, the speed is acceptable; it takes about 30 seconds (on average) per file. Of course, your mileage may vary.

Also, if your machine has 8MB or less of RAM, then EMX takes inordinate amounts of time to compile YACL -- as much as a whole day. This is mainly because GNU C++ is a memory hog when compiling templates, and YACL uses lots of templates. The result is that EMX thrashes badly on low-memory machines. But if you have at least 16MB, then EMX's speed is acceptable, with the whole compilation taking about 2 hours.

It seems that GNU C++ (and consequently the EMX compiler) do not actually inline functions that have been declared inline unless you specify the optimization switch (-O). But if you do specify the switch, the compile will go much slower. Bear this in mind when you choose to uncomment the OPTIMIZE symbol definition in the file `control/emxos2.ctl`.