Problem with `string', threading and shared libraries.
Mon Oct 1 19:33:00 GMT 2001
On Mon, Oct 01, 2001 at 08:38:12PM -0500, Loren James Rittle wrote:
> In article <email@example.com> you write:
> >Carlo Wood <firstname.lastname@example.org> writes:
> >| I really think that it was a wrong decision to include
> >| thread-safeness in the mangling of std::string.
> > So we're at least two then.
> When you agree with Carlo on this matter, be sure you fully understand
> what you are agreeing to.
> He had compiled libstdc++ with a macro, reserved to the
> implementation, defined and then he compiled his user code without
> that macro defined. Nowhere do we document that macro being used by
> normal users of the library.
I defined it while compiling my own library (libcwd), not while compiling
libstdc++. I read about _NOTHREADS in documentation of SGI. There I had
the feeling that it was recommended to define it for single threaded
application (to speed things up).
> Here is what we say in internal configuration documentation of the
> library, libstdc++-v3/include/bits/c++config :
> // [...] Note:
> // that gthr.h may well map to gthr-single.h which is a correct way to
> // express no threads support in gcc. As a user, do not define
> // _NOTHREADS without consideration of the consequences (e.g. it is an
> // internal ABI change).
> Note that it is explicitly marked as something that will change the
> ABI (i.e., you can't link code compiled with and without that macro
> defined). I honestly don't know how much more of a warning is merited
> for a symbol outside the normal user-space.
I didn't dig into libstdc++ internal configuration documentation for more
information :p, so the only "documentation" I had that I shouldn't touch it
was the fact that it starts with an underscore.
Just being used to _REENTRANT, which must be defined by the user when
compiling a thread-safe application AFAIK, it escaped me that I should not
define _NOTHREADS despite the mention of it somewhere in the many documentations
I read (sorry, I am new to threading since three weeks or so; I read so much
I have NO idea where I read it).
Thanks for clarifying this however :).
I'll remove the #define from my debugging library.
(I had still defined it for 3.0 and higher).
Carlo Wood <email@example.com>
More information about the Libstdc++