This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]