1 Requirements, Installation, and Deployment for Coherence for C++

After installing Coherence for C++ and setting up the environment, you can try running the sample applications.

1.1 Package Requirements

The following are required to use Coherence for C++:

1.2 Supported Environments

The current release of Coherence for C++ is supported on the platforms and operating systems listed in Table 1-1:

Table 1-1 Platform and Operating System Support for Coherence for C++

Operating System Compiler Architecture

Microsoft Windows 2000+ (see note 1)

MSVC 2005 SP1+ (see note 3)

x86

Microsoft Windows Server 2003+ (see note 2)

MSVC 2005 SP1+ (see note 3)

x64

Linux

GCC 3.4+ (see Note 4)

x86

Linux

GCC 3.4+ (see Note 4)

x64

Apple OS X 10.4+

GCC 3.4+ (see Note 4)

x86


Notes:

  1. Including Windows 32b XP, Vista, 2000, 2003, and 2008.

  2. Including Windows 64b XP, Vista, 2003, and 2008.

  3. Specifically MSVC 2005 SP1 (14.00.5+), and MSVC 2008 and express versions are supported.

  4. Specifically GCC 3.4.6-4 and above, and GCC 4.x versions are supported.

Note:

When deploying on Microsoft Windows, just as with any MSVC-based application, the Visual Studio 2005 SP1 C++ redistributable runtime libraries are required.

1.3 Installing Coherence for C++

  1. Download the Coherence for C++ package for your target environment.

  2. Extract the archive.

  3. Download the most recent patch for your target environment.

  4. Extract the patch archive, and copy contents over the installation directory

1.4 Building Coherence-Based Applications

1.4.1 Compiler Settings

When integrating Coherence for C++ into your application's build process, it is important that certain compiler and linker settings be enabled. Some settings are optional, but still highly recommended.

*MSVC (Visual Studio)*

Table 1-2 Compiler Settings for MSVC (Visual Studio)

Setting Build Type Required? Description

/EHsc

All

Yes

Enables C++ exception support

/GR

All

Yes

Enables C++ RTTI

/O2

Release

No

Enables speed optimizations

/MD

Release

Yes

Link against multi-threaded DLLs

/MDd

Debug

Yes

Link against multi-threaded debug DLLs


g++

Table 1-3 Compiler Settings for g++

Setting Build Type Required Description

-O3

Release

No

Enables speed optimizations


1.4.2 Coherence Header Files

Coherence ships with a set of header files which your application will need to compile code which uses the Coherence API. The header files are available under the installation's include directory. This include directory must be part of your compiler's include search path.

1.4.3 Linking

Coherence for C++ ships with both a debug and release version of the Coherence library. It is recommended that when compiling your application in debug mode that you also link against the Coherence debug library, by linking against coherence-debug rather then coherence. These libraries are located in the installation's lib directory. During linking this directory will need to be part of your linker's library path.

Table 1-4 Names of Linking Libraries for Release and Debug Versions

Operating System Release Library Debug Library

Windows

coherence.lib

coherence-debug.lib

Linux

libcoherence.so

libcoherence-debug.so

Apple OS X

libcoherence.dylib

libcoherence-debug.dylib


1.4.4 Runtime Library and Search Path

During execution of a Coherence enabled application the Coherence for C++ shared library must be available from your application's library search path. This is achieved by adding the directory which contains the shared library to an operating system dependent environment variable. The installation includes libraries in its lib subdirectory.

Table 1-5 Name of the Coherence for C++ Library and Environment Variables

Operating System Environment Variable

Windows

PATH

Linux

LD_LIBRARY_PATH

Apple (Mac) OS X

DYLD_LIBRARY_PATH


For example, to set the PATH environment variable on Windows execute:

c:\coherence\coherence-cpp\examples> set PATH=%PATH%;c:\coherence\coherence-cpp\lib

As with the Java version of Coherence, the C++ version supports a concept of System Properties to override configuration defaults. System Properties in C++ are set by using standard OS environment variables, and use the same names as their Java counterparts. The tangosol.coherence.cacheconfig system property can be used to specify the location of the cache configuration file. You may also set the configuration location programatically (CacheFactory::configure()) from application code, the examples however do not do this.

Table 1-6 Cache Configuration System Property Value for Various Operating Systems

Operating System System Property

Windows

tangosol.coherence.cacheconfig

Linux

TangosolCoherenceCacheConfig

Solaris

TangosolCoherenceCacheConfig

Apple (Mac) OS X

TangosolCoherenceCacheConfig


Note:

Some OS shells, such as the UNIX bash shell, do not support environment variables which include the '.' character. In this case, you may specify the name in camel case, where the first letter, and every letter following a '.' is capitalized. That is, "tangosol.coherence.cacheconfig" becomes "TangosolCoherenceCacheConfig".

For example, to set the configuration location on Windows execute:

c:\coherence\coherence-cpp\examples> set tangosol.coherence.cacheconfig=config\extend-cache-config.xml

1.5 Deploying Coherence for C++

Coherence for C++ requires no specialized deployment configuration. Simply link your application with the Coherence library and follow the configuration instructions. See the sample applications for examples of build scripts and configuration.

Note:

When deploying to Microsoft Windows the Visual Studio 2005 SP1 C++ runtime libraries are required. To build the samples a version of Visual Studio 2005 SP1 or higher is required.