xContract - Contract Enforcement for C and C++ STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... Synesis Software

Building and Linking to the Libraries

Installing the library

xContract comes as a source-only distribution, meaning that you will need to build the library before you can use it. The library depends one other open source project: STLSoft. If you wish to build xContract using the makefiles supplied, you will need to have defined the STLSOFT environment variable to be the root directory of the STLSoft include files. (See the STLSoft distribution for more details.) Because STLSoft is 100% header-only, there are no further steps required.

The distribution is in the form of a zip file, e.g. xcontract-0.3.3.zip which you should extract (recursively) to a location of your choice, e.g. c:\opensrc\xContract\1.0, or ~/opensrc/xContract/1.0, which will be referred to in the subsequent documentation as <XCONTRACT-install-dir>.

Building the library for your compiler(s)

Via makefile

Makefiles for all the main supported compilers are included in the subdirectories of the build directory. For example, the makefile for Borland C/C++ v5.6 is in build/bc56. Since Borland is only supported on Windows, there is a single makefile called makefile.

Hence, to build xContract for Borland C/C++ 5.6 you need open a Windows command box (with the environment set up for the compiler and linker) and execute the following command:

  <XCONTRACT-install-dir>\build\bc56> make -f makefile

or just:

  <XCONTRACT-install-dir>\build\bc56> make

Note:
For compilers that are supported on more than one platform, the makefiles are located in different sub-directories. For example, for GNU C/C++ v3.4, which is supported for both UNIX and Windows (32-bit), the makefiles are located in <XCONTRACT-install-dir>/build/gcc34.unix and <XCONTRACT-install-dir>/build/gcc34.win32, respectively.

With the Visual C++ 6.0 project files

Also included are Visual C++ 6.0 project files for the libraries and example and test programs. These files can be read (and converted) by any later version of Visual C++.

Just open the workspace file xcontract.vc6.dsw, located in the root directory (i.e. <XCONTRACT-install-dir>), and select the Build-All option.

Note:
You need to have the STLSOFT environment variable set up correctly.

Linking the library

There are two options for linking to the core library: explicit linking and implicit linking.

Explicit Linking

Explicit linking requires that you stipulate the requisite library name (and associated path) to your compiler/linker.

For example,

to be completed

Optional Implicit Linking

to be completed

xContract Library documentation © Matthew Wilson and Synesis Software Pty Ltd, 2001-2008 SourceForge.net Logo