After installing Coherence for C++ and setting up the environment, you can try running the sample applications.
The following are required to use Coherence for C++:
C++ development environment
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:
Including Windows 32b XP, Vista, 2000, 2003, and 2008.
Including Windows 64b XP, Vista, 2003, and 2008.
Specifically MSVC 2005 SP1 (14.00.5+), and MSVC 2008 and express versions are supported.
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.Download the Coherence for C++ package for your target environment.
Extract the archive.
Download the most recent patch for your target environment.
Extract the patch archive, and copy contents over the installation directory
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.
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 |
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.
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.
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
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.