This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Request for help with libcwd
- To: libstdc++ at gcc dot gnu dot org
- Subject: Request for help with libcwd
- From: Carlo Wood <carlo at alinoe dot com>
- Date: Wed, 10 Oct 2001 17:05:43 +0200
While my previous post is a request for support in a future
release of libstdc++, I will still need a work-around for
the current compiler versions. Hence the following request
for suggestions.
In the process of making libcwd thread-safe, and confronted
with the fact that I *do* write debug output from malloc
there is only one solution: libcwd needs to replace the
allocator(s) that is/are used during the writing of debug
output.
Because libcwd only gets an std::ostream* passed, there is
no possibility to change the allocator by means of changing
the template parameter.
Fortunately, I've build in a safety guard for such problems
and demanded from the start that every compilation unit
#includes a header file (which is part of libcwd) prior to
including ANYTHING else. This makes it possible to literally
replace stl_alloc.h if I'd like to.
The question remains however, what would be the best way to
do this? For example, is this still supported:
#define alloc myAlloc
#include <stl_alloc.h>
?
In a worsed case scenario, the user could be writing to
a custom basic_stringstream using any arbitrary allocator, as
long as that is an allocator from libstdc++, it should work;
and thus I will need to replace every libstdc++ allocator
that uses locking. What is a good way to do this (taking
into account I control the first header file that is included
in all compilation units and that I am linking a shared library
with the application)?
--
Carlo Wood <carlo@alinoe.com>