bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gettext 0.13.1 - workaround ms bug


From: Petr Pytelka
Subject: Gettext 0.13.1 - workaround ms bug
Date: Thu, 21 Oct 2004 01:39:28 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922

Hi,

we are using Gettext 0.13.1 on Win32. There is not possible to change language "on the fly". This problem is due too "bug" (different behaviour) in getenv() function on Win32. Problem arise in using DLL version.

We think that best solution is to export one more function in Win32 implementation which allow to workaround this problem. Function is called libintl_putenv and allow to set variable inside DLL runtime space.

Sorry for my broken English. I hope that you understand problem and described solution. I was looking around Internet and it looks like that more users found this problem and there is not good solution.

Thank you very much.

Petr Pytelka


Solution:

1. Add file putenv.c

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#ifdef _LIBC
# define __need_NULL
# include <stddef.h>
#else
# include <stdlib.h>              /* Just for NULL.  */
#endif

#if defined _MSC_VER && BUILDING_DLL
# define DLL_EXPORTED __declspec(dllexport)
#else
# define DLL_EXPORTED
#endif

DLL_EXPORTED void libintl_putenv (const char *pVar)
{
        _putenv(pVar);
}

2. Add to libintl.h

#ifdef WIN32
#ifdef _INTL_REDIRECT_INLINE
extern LIBINTL_DLL_EXPORTED void libintl_putenv (const char *pVar);
#endif
#endif

3. Add putenv.c to Makefile.msvc
OBJECTS = bindtextdom.obj dcgettext.obj dgettext.obj gettext.obj finddomain.obj loadmsgcat.obj localealias.obj textdomain.obj l10nflist.obj explodename.obj dcigettext.obj dcngettext.obj dngettext.obj ngettext.obj plural.obj plural-exp.obj localcharset.obj relocatable.obj localename.obj log.obj putenv.obj printf.obj osdep.obj intl-compat.obj

putenv.obj : $(srcdir)\putenv.c
        $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c $(srcdir)\putenv.c





reply via email to

[Prev in Thread] Current Thread [Next in Thread]