Using stlport and Cstd in same application

Hello,

I have two 3rd party C++ libraries. One of them is using stlport, second classic Cstd library. Is it possible to make application which will use both of them at the same time?

I know that easy answer is 'no'. I have contacted both vendors - stlport-based one says "We won't support old crappy libraries", Cstd-based one says "Cstd is default library on Sun Studio, we don't want to support two versions of library on one platform". Is there any way to link the application with both libraries? Main benefit is that none of these two libraries actually expose std:: in their interfaces - they just need the implementation internally.

I have no issues with linking statically with their libraries - maybe some kind of prebinding would be possible? Something like taking one library, linking it statically with Cstd, nuking all export symbols from std::, and then linking the resulting static library with rest of the program? I'm bit scared about static initializers - after all, both libraries would like to have their own cout working...

Failing that, we will probably have to use two processes with some kind of IPC between them - but at this point it can be probably done with java a lot easier (C++ was chosen because we need every single bit of speed and no gc pauses).

[1318 byte] By [abiesa] at [2007-11-27 11:39:04]
# 1

The prob lem is that global types, functions, and objects in each library have the same names, the names mandated by the C++ Standard.

As an example, suppose both 3rd-party libraries used the std::string class. The class layout and member function definitions are different. If the interface to each class involves string objects, there is no way in your own code to provide both types of string.

If you can separate the interfaces so that no type, object, or function is in both interfaces, it might be possible to use some advanced binding options of the Solaris linker to keep the interfaces separate. You can read the Linker and Libraries Guide for more information. Look in docs.sun.com for the version of the Guide that matches your Solaris version.

You can also check out the Open Solaris dynamic linking community

http://opensolaris.org/os/community/tools/linker/

Even if you can separate the interfaces, you still might have issues with the standard streams: cin, cout, cerr. If each library uses these streams internally, they will separately buffer the same underlying file descriptor, causing potential chaos.

clamage45a at 2007-7-29 17:23:51 > top of Java-index,Development Tools,Solaris and Linux Development Tools...