Migrating from Rogue Wave (RW) Tools.h++ library which is shipped with Sun Studio Compiler to Linux Platform
Prepared by: Prakash Mirji, HPES, prakash.mirji@hp.com
Background
Tools.h++ is one of the popular C++ class library from Rogue Wave. It is a collection of algorithms, containers, iterators and other fundamental components. There are other libraries like dbtools.h++ as well. The “.h++” products/libraries were combined in 2001 into the product family SourcePro C++. Note that the tools.h++ library predated the ANSI/ISO standard for C++ language.
In 2005, Rogue Wave handed over the tools.h++ to Apache Foundation, who have developed and packaged into Apache C++ Standard Library project (code name, stdcxx, pronounced “Standard C++ Library”). It is now open sourced and can be downloaded from Apache Foundation. More details about Apache C++ Standard library can be found at http://stdcxx.apache.org/
Sun Studio and RW Tools.h++ Relation
Sun ships RW tools.h++ library in two ways:
- Packages with Sun Studio Compiler
- As a separate library “librwtools.so/a” ( separately link with the application code).
Sun continues to bundle tools.h++ just to keep the backward compatibility even though it doesn’t meet current C++ standards. Most of the tools.h++ classes/types are now available in the C++ standard library which comes with each vendor. A list of such few classes is given below along with corresponding ISO C++ Standard Library classes.
Tools.h++ type |
C++ standard library type |
RWCString |
std::basic_string |
RWCTokenizer |
No equivalent.
Need to write our own. |
RWTValHashDictionary <> |
std::map<T> |
RWTValHashDictionaryIterator <> |
std::map::iterator |
RWTValSlist <> |
std::list <T> |
RWTValSlistIterator <> |
std::list::iterator |
Migration Problem
The applications using tools.h++ from sun doesn’t compile on Linux with gcc compiler. GCC compiler doesn’t bundle tools.h++ library similar to Sun Studio compiler. Below are the solutions to address the problem.
Migration Solution 1 (Industry Standard and Sun Recommended)
As stated above, RW tools.h++ is a very old product, which has not had significant updates in many years. It is predated and doesn’t conformance to the C++ Standard. Most of the functionality in the RW tools.h++ is available in Standard C++ libraries, although the programming interface is different. (That is, if you have the code written for RW Tools.h++, it will need to be re-written).
The benefits of recoding the API with native C++ standard library mentioned below :
- Full conformance to the C++ Standard
- Code more portable ( across platform and across compiler)
- Native to the platform and may have better performance
It is highly recommended to re-code the applications using RW tools.h++ classes with native C++ standard library classes.
The downside of this approach is that it requires more effort to code and test the application.
Migration Solution 2
If decision is not to change the RW tools.h++ interfaces, buy the library from Rogue Wave. Or use the open source C++ Standard library (stdcxx) from Apache Foundation.
Note: On Sun platform, if applications are using other libraries from RW like dbtools.h++, then the only option is to buy the product for Linux platform. (This is the case with Fidelity application)
The downside of this approach is that application is tied to vendor and less portable.
Migration Solution 3
Download and install Oracle Solaris Studio (formerly Sun Studio) for Linux platform. It is freely available on both Solaris and Linux operating systems. More details about the product can be found at http://www.oracle.com/technetwork/server-storage/solarisstudio/overview/index.html
As stated above, the Sun Studio is bundled with RW tools.h++ library. The applications coded with RW tools.h++ classes can be compiled without making any changes. However, need to pass compiler flag i.e. .‘-library=rwtools7, iostream, no%Cstd’. This tells the compiler to use Rogue Wave Tools.h++ library, use classic iostream library, and NOT to use C++ standard library.
Some customers prefer this approach. I’ve used this method at BNYM.
The downside of this approach:
- Application code uses non standard C++ language standards
- Not making use of native GCC compiler
- Tied to 3rd party compiler. Sun might stop shipping tools.h++ library from future versions of its compiler on Linux platform
- Generated binaries/libraries may not be optimized due to use of 3rd party compiler on Linux. This may result as slight performance hit.