473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

STL with shared library

S S
Hi

Are there some known issues using STL with shared library. Recently I
got some crash for which the reason I dont see any, and searching on
goolge shown some such issues with shared library.

If somebody can help ? Thanks in advance.

S
Jun 27 '08 #1
3 3176
S S wrote:
Are there some known issues using STL with shared library. Recently I
got some crash for which the reason I dont see any, and searching on
goolge shown some such issues with shared library.

If somebody can help ? Thanks in advance.
Yes, there are, IIRC. You need to look in the archives for the
discussions on the subject, I am certain you can find something of
interest. I believe it mostly relates to the fact that some shared
objects (libraries) have their own heap and when objects that have their
own dynamic memory (like std::string or std::vector) are created inside
those libraries, the contents may not be readily accessible outside. To
be entirely honest, I don't remember the exact problems, but I've run
into something like that a couple of times.

The bottom line is however that the issue is not really with STL but
with dynamic linking and having a heap in the shared library.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #2
S S
On Jun 2, 8:23*pm, Victor Bazarov <v.Abaza...@comAcast.netwrote:
S S wrote:
Are there some known issues using STL with shared library. Recently I
got some crash for which the reason I dont see any, and searching on
goolge shown some such issues with shared library.
If somebody can help ? Thanks in advance.

Yes, there are, IIRC. *You need to look in the archives for the
discussions on the subject, I am certain you can find something of
interest. *I believe it mostly relates to the fact that some shared
objects (libraries) have their own heap and when objects that have their
own dynamic memory (like std::string or std::vector) are created inside
those libraries, the contents may not be readily accessible outside. *To
be entirely honest, I don't remember the exact problems, but I've run
into something like that a couple of times.

The bottom line is however that the issue is not really with STL but
with dynamic linking and having a heap in the shared library.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Thanks for the pointers. But that means, we can never use shared
library with STL ? After some searching I found that multiple memory
managers can not be together in case of shared libs. But even if I use
static library, we still have multiple memory managers ? So why static
libs do not have problems?
Jun 27 '08 #3
S S wrote:
On Jun 2, 8:23 pm, Victor Bazarov <v.Abaza...@comAcast.netwrote:
>S S wrote:
>>Are there some known issues using STL with shared library. Recently I
got some crash for which the reason I dont see any, and searching on
goolge shown some such issues with shared library.
If somebody can help ? Thanks in advance.
Yes, there are, IIRC. You need to look in the archives for the
discussions on the subject, I am certain you can find something of
interest. I believe it mostly relates to the fact that some shared
objects (libraries) have their own heap and when objects that have their
own dynamic memory (like std::string or std::vector) are created inside
those libraries, the contents may not be readily accessible outside. To
be entirely honest, I don't remember the exact problems, but I've run
into something like that a couple of times.

The bottom line is however that the issue is not really with STL but
with dynamic linking and having a heap in the shared library.

Thanks for the pointers. But that means, we can never use shared
library with STL ?
No, it means you need to learn about the existing issues and ways to
solve the problems when they present themselves. If driving your car
can cause crashing into a wall, do you stop driving altogether?
After some searching I found that multiple memory
managers can not be together in case of shared libs. But even if I use
static library, we still have multiple memory managers ? So why static
libs do not have problems?
Static libs and dynamic libs are features of your compiler/platform and
not really topical in a language newsgroup, sorry. The differences
between how libraries are linked with the rest of the program dictate
what issues can interfere with the use of the library and how to work
around those issues, but those solutions are not *language specific*,
nor are they platform-independent. AFAIK, static libraries are like
your own code, it's just object modules pulled from a different
repository, while dynamic libraries are totally different kind of code
that your program can call during run-time. So, the difference is not
between a static library and a dynamic library, it's between your code
and the code that resides in a dynamic library and is linked with
dynamically.

I strongly suggest getting familiar with the issues and learning how
memory management works on your platform and what it means to have a
custom "allocator" for your standard container. Utilizing allocators is
a significant part of the whole process of learning to use the Standard
Library, and there are whole books written on the subject. I strongly
encourage you to get yourself a copy of Nicolai Josuttis' "C++ Standard
Library: A Tutorial And a Reference". When you have more specific
questions, come back and ask them.

Good luck!

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Simon | last post by:
Hello. I wanna use my dynamic shared library(built with C language) with php script. (PHP version is 4.0.6) So I making a shared library(*.so) in Solaris environment(2.7) and it is successful....
5
by: Oliver | last post by:
Hi, I have a problem with a shared library of mine. I compile the *.o files and then generate the .so lib with: cc -shared libjava_vrpn.so *.o When I then run my program I get an error for an...
1
by: Torsten Mueller | last post by:
I have to create a shared library containing C++ classes with static member variables on HPUX with aCC. I can compile and link the library and a test application but when I start the program I get...
6
by: klh | last post by:
I have an old version of DB2 Connect (v 6) installed on a Sun Solaris (v 2.9)box. It has been installed for several years, and to me, it seems to work okay. However, an application that uses DB2...
2
by: santa19992000 | last post by:
Confusing th eword with "library", "shared library" and how to use these things in real C project, is there any small example I can take a look. Thanks.
7
by: akennis | last post by:
First of all, sorry for duplicating this post. I put it up in the alt.comp.lang.learn.c-c++ mistakenly. I'm investigating a problem whereby exceptions thrown from functions in a Shared Library...
5
by: David T. Ashley | last post by:
I've occasionally had trouble compiling and linking programs that use shared libraries. That never made a lot of sense to me, because I thought the operating system went hunting for the symbols...
3
by: Bala | last post by:
Hello, I am trying to create a shared library on solaris. The inputs to this library is a source file and then 2 static libraries. I need to call code within the shared library in another...
4
by: Nethali | last post by:
Hi folks, Is there any way to embed shared library directly, to executable file it self so that executable file can run stand alone without the shared library. I don't want to compile the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.