This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Multiple std::messages instances for different text domains
- From: Sam Varshavchik <mrsam at courier-mta dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Sun, 14 Jun 2009 10:12:25 -0400
- Subject: Multiple std::messages instances for different text domains
I'm looking at the implementation of std::messages
(libstdc++-v3/config/locale/gnu), and I'm trying to understand the
following.
From what I can figure out, do_open() calls textdomain(), and do_get() then
calls gettext() to retrieve the messages.
So, if there are two std::messages facets in use, and the first one's open()
method gets invoked specifying text domain X, and the second one's open()
method gets invoked specifying text domain Y, then the first instance's
get() method will no longer work, since the gettext() function now uses text
domain Y, rather than X.
Invoking libintl directly, shared libraries can work with their own message
catalogs without affecting the main application by using dgettext() instead
of gettext(). As far as I can see, I can't use std::messages facets in my
shared library, doing so will mess up the application, if it also uses
gettext(), either directly or via std::messages.
I think that do_open() should, instead, save the text domain in the facet,
and do_get() should use dgettext() instead of gettext().
Attachment:
pgp00000.pgp
Description: PGP signature