# How to use YACL with Borland C++

Last update: June 2, 1997

This file provides directions on how to build YACL and its demo programs using the Borland C++ compiler.

## Building YACL

0. Create and change into the directory you want to install YACL in. For example:

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

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

`unzip yacl0160.zip`

or, if you use pkunzip under DOS:

`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 file `control\borlandc.ctl`. In that file, set the variable `BCPATH` to point to the root directory of your Borland C++ system, e.g.,

`set BCPATH=c:\bc4`

4. If you are building the library under MS-Windows, you need to do these additional steps:

4a. Copy the file `ctl3d.h` from the `lib\windows` directory into the Borland include directory, e.g.,

`copy c:\yacl\lib\windows\ctl3d.h c:\bc4\include`

or copy it to the directory $(YACLPATH)\ui.

4b. Run implib to create ctl3d.lib, e.g.:

`cd c:\yacl\lib\windows implib ctl3d.lib ctl3d.dll`

5. Build the libraries. CD into the directory you chose in step 0 and issue the make command as below:

(a) MS-Windows: Type

`make -f borlandc.mak -DDOS`

to build the DOS version, or

`make -f borlandc.mak`

to build the Windows version. The UI library is available under Windows, Windows NT, Windows 95 and OS/2 PM but not plain DOS.

(b) OS/2: In an OS/2 command window, type

`make -f borlandc.mak`

(c) Windows NT or Windows 95: In a Windows NT command window (using CMD.EXE, not COMMAND.COM), type

`make -f borlandc.mak -DWIN32`

6. Poke around in the directory structures under basedemo and uidemo; build and try out the programs there using the makefiles provided. Each demo program is in a separate directory with a Borland-specific makefile called borlandc.mak. 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.

You can also build a debug version of the library via the command

`make -f borlandc.mak -DDEBUG`

If you wish to build a DLL version, type the command

`make -f borlandc.mak -DBUILD_DLL`

This will build the files base.dll and io.dll as well as the import libraries base.lib and io.lib in the library directory. To build any of the demo programs in the uidemo directory so as to use these DLLs, type the command

`make -f borlandc.mak -DUSE_YACL_DLL`

Note that DLLs only work under Win32 and OS/2. They don't yet work under 16-bit Windows. Note also that, if you're using DLLs, you MUST build the application with the USE_YACL_DLL symbol defined. Otherwise you might get undefined symbols, or the app might crash.

## Known problems

Borland C++ 5.0. BC5 seems to issue some spurious warnings about variables being assigned values that are never used. Also, BC5 instantiates a lot more templates than does BC4, so the library utility (TLIB) issues warnings about duplicate symbols.

Borland C++ 1.5 under OS/2 and the String class. It seems as if expressions involving Strings with concatenation, such as

`return s1 + s2 + s3 + s4;`

as the arm of a switch statement cause the program to crash; for example the `CL_Date::PrintString` method. The exact same code works fine under BC++ for DOS/Windows and GNU C++. I'd guess that BCOS2 is generating bad code for this one case. The straightforward workaround is to use String's `AssignWithFormat` method.

Shared libraries (DLLs). The UI classes don't seem to work reliably when built as a DLL under Windows NT. I'm still investigating why this happens.