Problem with locales in unloaded DLLs

From: Hendrik Schober (SpamTrap_at_gmx.de)
Date: 10/26/04


Date: Tue, 26 Oct 2004 18:23:12 +0200


[x-posted to microsoft.public.dotnet.languages.vc
and microsoft.public.vc.stl]

Hi,

we just ran into a bug that seems to be a show-
stopper for us.
We are making a plugin (DLL) for some application.
It is loaded from the app (presumably) using
'LoadLibrary()'. Then code in the DLL is executed.
Sometimes, this implies calls to 'std::issspace()'
which in turn will call 'locale::facet::_Register()'
to register a locale with the C++ runtime. Later
on, the DLL will be unloaded. However, the run-
time only treis to un-register the facet when the
/process/ terminates. At this time the DLL is long
gone and the app thus crashes at shutdown.

A search across the KB (using the term "register
locale crash") didn't come up with something.
Google did find a reference to what appears to be
this bug. (Search for the string "DINKUMWARE BUG"
on http://cvs.sourceforge.net/viewcvs.py/filezilla/FileZilla%20Server/source/misc/StdString.h?rev=1.4)

Is there any fix for this? We use a few 3rd-party
libs that call locale-dependend functions which
will trigger this bug. It would be a huge problem
if we had to go through all this code and try to
understand it in order to fix the problem.

TIA,

Schobi

-- 
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org
"The presence of those seeking the truth is infinitely
 to be prefered to those thinking they've found it."
 Terry Pratchett


Relevant Pages

  • Re: Memory increasing even when in debug-break
    ... another test machine that is running the app under .Net 1.1 is still ... I'm left wondering whether this bug is even related. ... leak occurs in a process that uses Corperfmonext.dll in the .NET Framework ... to do this whole DLL injection thing for apps that query performance data... ...
    (microsoft.public.vsnet.debugging)
  • Problem with locales in unloaded DLLs
    ... We are making a plugin (DLL) for some application. ... locale crash") didn't come up with something. ... this bug. ... I'm Schobi at suespammers dot org ...
    (microsoft.public.dotnet.languages.vc)
  • Re: c code reusability
    ... Program X uses DLL Y. DLL Y is "improved", and a bug is introduced. ... At least one OS I use has deprecated static linking for all ... It's way easier to fix a library bug with a patch ...
    (comp.lang.c)
  • Re: c code reusability
    ... an already-buggy program, this is a wash. ... Just fix the bug and ship the executable, which is no harder than fixing the bug and shipping the DLL. ... If your dll is used by several client executables, you can't ship the executable, they would have to relink with a new version of the ...
    (comp.lang.c)
  • Re: code within libraries vs code within same project
    ... Is this a bug in System.Diagnostics.StackTrace? ... //the .dll do not appear to have all the info, particularly filename. ...
    (microsoft.public.dotnet.languages.csharp)