On 09/29/08 13:29, Andrey Hristov wrote:
 Hi,
I am writing an OO.org extension that is a thin wrapper around a C++ library, which is compiled externally. So far, so good. However, I started to get strange problems with std::string objects. I was getting strange results from the library. Then I realized that std::string::length() in the extension was delivering bad data, like -121387687 . strlen() on .c_str() of a std::string from the extension did the work, till there was a place where there is a copy-ctor called in the library with parameter a std::string from the extension. Then I recalled OO.org is being compiled with STLPort, while the library uses the platform's (Linux) STL implementation and there is probably a class. ldd tells me that soffice.bin is references the native STL implementation. How can I get access to it in my extension? I read a bit about STLPort and saw that there is a mode in which using macro magic std:: is changed to the stlport's namespace. Is this being used in OO.org?

Thanks for any advice!

You might be able to solve this problem by keeping separate the part of your extension that interfaces with OOo's UNO (which must include C++ headers from OOo's STLport) and the part that interfaces with the third-party C++ library (which must include C++ headers that match the compiler with which the third-party library has been built), ideally with just a C interface between those two parts.

(Also, note that it might or might not be trivial to satisfy in an OOo extension the dependencies of the third-party library. For example, at least the vanilla, Sun-built OOo comes with rather old versions of libstdc++.so.6 and libgcc_s.so.1. If the third-party library needs later versions of those, it is difficult to make them available to it.)

soffice.bin (indirectly) links against libstdc++.so.6 and libstlport_gcc.so, where OOo takes any STL-related functionality from the latter. (And yes, OOo's STLport headers use macros to exchange the compiler's std namespace with STLport's _STL namespace.)

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to