Skip Headers
Oracle® TimesTen In-Memory Database TTClasses Guide
Release 11.2.1

Part Number E13074-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

2 Compiling TTClasses

TTClasses comes compiled and preconfigured during TimesTen installation. To recompile TTClasses, use the make (UNIX) or nmake (Windows) command. This chapter describes the compilation process and introduces the Quick Start demo applications for TTClasses.

Compiling TTClasses on UNIX

To use TTClasses, ensure that your shell environment variables are set correctly. You can optionally run one of the following scripts or add a call to one of these scripts in your login initialization script (.profile or .cshrc), where install_dir is the installation directory for your TimesTen instance:

install_dir/bin/ttenv.sh    (sh/ksh/bash)
install_dir/bin/ttenv.csh   (csh/tcsh)

After your PATH and shared library load path are configured properly, you can change to the TTClasses directory and recompile TTClasses:

$ cd install_dir/ttclasses
$ make

Compiling TTClasses on Windows

On Windows, you can either set environment variables during installation or run:

install_dir\bin\ttenv.bat

If you want to recompile TTClasses, change to the ttclasses directory, where install_dir is the installation directory for your TimesTen instance:

install_dir\ttclasses

Before recompiling, ensure that the PATH, INCLUDE, and LIB environment variables point to the correct Visual Studio directories. There is a batch file you can run, named VCVARS32.BAT (Visual C++ 6.0) or VSVARS32.BAT (Visual Studio .NET) in the Visual Studio directory tree, that will set up your PATH, INCLUDE, and LIB environment variables correctly.

Then, to recompile TTClasses if you are using Visual Studio .NET:

install_dir\ttclasses> nmake /f Makefile.vsdotnet

Or if you are using VC++ 6.0:

install_dir\ttclasses> nmake

Compilation options

The following "make target" options are available when you compile TTClasses:

To specify a make target, use the name of the make target on the command line.

To build a shared, debug version of TTClasses:

(Unix)

$ make clean shared_debug

(Windows)

install_dir\ttclasses> nmake clean shared_debug

Compiling TTClasses for client/server mode

To compile TTClasses for client/server mode, use the MakefileCS Makefile.

Example 2-1 shows how to build a client/server version of TTClasses.

Example 2-1 TTClasses compilation for client/server mode

(Unix)

$ make -f MakefileCS clean all

(Windows)

install_dir\ttclasses> nmake /f MakefileCS clean all

Installing TTClasses after compilation (UNIX only)

After compilation, install the library so all users of the TimesTen instance can use TTClasses. This step is not part of compilation because different privileges are required for installing TTClasses than for compiling TTClasses.

Example 2-2 shows the steps to install the TTClasses library on a UNIX or Linux system. Note that installation occurs automatically after compilation on Microsoft Windows.

Example 2-2 Installation of TTClasses library

$ cd install_dir/ttclasses
$ make install

TTClasses compiler macros

Most users do not need to manipulate the TTClasses Makefile. If you need to modify the TTClasses Makefile manually, you can add flags for the TTClasses compiler macros to the Makefile. For Unix, add -Dflagname; for Windows, add /Dflagname.

This section includes information about the following compiler macros:

Also see "Platform-specific compiler macros".

TTEXCEPT: Throw C++ exceptions

Compile TTClasses with the -DTTEXCEPT flag to make TTClasses throw C++ exceptions. Put try/catch blocks around all TTClasses function calls and catch exceptions of type TTStatus. See "TTStatus".

Flags for C++ I/O streams: TTC_USE_STRINGSTREAM, USE_OLD_CPP_STREAMS

There are multiple types of C++ streams, and they are not compatible with each other. TimesTen provides two related flags. The types of streams you use in your application determines which flag to use, or whether you should use neither, as follows:

  • For relatively new (but not the newest) types of streams, where you are including <iostream> and using the ostrstream class, use neither flag. This is the default for most platforms and compilers.

  • For the newest types of streams, where you are including <iostream> and using the ostringstream class, use the TTC_USE_STRINGSTREAM flag.

  • For old types of streams, where you are including <iostream.h> and using the ostrstream class, use the USE_OLD_CPP_STREAMS flag. This is the default for some older platforms and compilers.

Check your TTClasses Makefile to see if either flag is set. If the flags are not set properly, then update the Makefile as appropriate, recompile TTClasses, and replace the previous TTClasses library file with the recompiled one.

Further information is provided in the subsections that follow.

Neither flag: for C++ I/O stream code with ostrstream

As noted above, if you are using C++ I/O stream code where you are including <iostream> and using the ostrstream class, neither the TTC_USE_STRINGSTREAM flag nor the USE_OLD_CPP_STREAMS flag should be set. If either is set in the TTClasses Makefile, remove the line and recompile TTClasses.

TTC_USE_STRINGSTREAM: for newest C++ I/O stream code with ostringstream

This compiler flag is for use with C++ compilers that reliably support the newest C++ stream types and the ostringstream class. If your program uses the newest stream types, then TTClasses must be compiled with the -DTTC_USE_STRINGSTREAM setting. This allows TimesTen to use ostringstream and <iostream> for compatibility with your program code.

Also note that if your program uses the newest C++ streams, the USE_OLD_CPP_STREAMS flag must not be set. If the TTClasses Makefile has the wrong settings, correct them and recompile TTClasses.

Note:

With gcc version 3.2 or higher, the TTC_USE_STRINGSTREAM flag is set by default in the file install_dir/include/ttclasses/TTIostream.h.

USE_OLD_CPP_STREAMS: for old C++ I/O stream code

This compiler flag is for older C++ compilers that do not support <iostream>. If your program uses old C++ streams, where you include <iostream.h> and use ostrstream, then TTClasses must be compiled with the -DUSE_OLD_CPP_STREAMS setting to be compatible with your program code.

Also note that if your program uses old C++ streams, the TTC_USE_STRINGSTREAM flag must not be set. If the TTClasses Makefile has the wrong settings, correct them and recompile TTClasses.

TTDEBUG:Generate additional debugging and error checking logic

Compile TTClasses with -DTTDEBUG to generate extra debugging information. This extra information reduces performance slightly, so use this flag only in development (not production) systems.

TT_64BIT: Use TTClasses with 64-bit TimesTen

Compile TTClasses with -DTT_64BIT if you are writing a 64-bit TimesTen application.

Note that 64-bit TTClasses has been tested on AIX, HP-UX, Solaris, Red Hat Linux, and Tru64.

Platform-specific compiler macros

The following compiler macros are specific to a particular platform or compiler combination. You should not have to specify these compiler macros manually. Their use is determined by the Makefile chosen by the configure program.

GCC

Compile TTClasses with the -DGCC flag when using gcc on any platform.

HPUX

Compile TTClasses with the -DHPUX flag when compiling on HP-UX.

About the TimesTen TTClasses demos

After you have configured your C++ environment, you can confirm that everything is set up correctly by compiling and running the TimesTen Quick Start demo applications. Refer to the Quick Start welcome page at install_dir/quickstart.html, especially the links under Sample Programs, for information about the following: