This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: LoadLibrary error 487 (was Re: Please test latest developer snapshot)
On Feb 28 21:15, Corinna Vinschen wrote:
> On Feb 28 14:49, Christopher Faylor wrote:
> > On Mon, Feb 28, 2011 at 11:01:46AM +0100, Corinna Vinschen wrote:
> > >(*) Actually I tried to reproduce the problem on Windows NT4, 2000, XP,
> > > 2003, 2008, and W7. Only XP was affected at all.
> >
> > I tried to reproduce on most of those and saw nothing too. I just don't
> > know what situation this will crop up in. We don't check specifically
> > for XP so we may be introducing weird hard-to-diagnose behavior.
> >
> > All strange behavior would be guaranteed gone if we loaded the DLL
> > statically. I wonder if we loaded the DLL statically and only removed
> > on symbol from the autoload if it would help with any slowness in
> > linking since we'd still be linking all of the symbols dynamically.
>
> This speaks against loading winmm statically:
>
> http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.clr/2007-02/msg00000.html
>
> Why not test for XP specificailly and be done with it?
Like this:
Index: autoload.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/autoload.cc,v
retrieving revision 1.186
diff -u -p -r1.186 autoload.cc
--- autoload.cc 27 Feb 2011 09:45:58 -0000 1.186
+++ autoload.cc 28 Feb 2011 20:20:10 -0000
@@ -216,7 +216,8 @@ static bool
dll_load (HANDLE& handle, WCHAR *name)
{
HANDLE h = LoadLibraryW (name);
- if (!h && in_forkee && handle && GetLastError () == ERROR_INVALID_ADDRESS)
+ if (!h && in_forkee && handle && GetLastError () == ERROR_INVALID_ADDRESS
+ && wincap.has_broken_winmm ())
h = LoadLibraryExW (name, NULL, DONT_RESOLVE_DLL_REFERENCES);
return h ? (handle = h) : 0;
}
Index: wincap.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/wincap.cc,v
retrieving revision 1.106
diff -u -p -r1.106 wincap.cc
--- wincap.cc 30 Jan 2011 21:52:11 -0000 1.106
+++ wincap.cc 28 Feb 2011 20:20:10 -0000
@@ -61,6 +61,7 @@ wincaps wincap_nt4sp4 __attribute__((sec
has_buggy_thread_startup:false,
has_fast_cwd:false,
has_restricted_raw_disk_access:false,
+ has_broken_winmm:false,
};
wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -101,6 +102,7 @@ wincaps wincap_2000 __attribute__((secti
has_buggy_thread_startup:false,
has_fast_cwd:false,
has_restricted_raw_disk_access:false,
+ has_broken_winmm:false,
};
wincaps wincap_2000sp4 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -141,6 +143,7 @@ wincaps wincap_2000sp4 __attribute__((se
has_buggy_thread_startup:false,
has_fast_cwd:false,
has_restricted_raw_disk_access:false,
+ has_broken_winmm:false,
};
wincaps wincap_xp __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -181,6 +184,7 @@ wincaps wincap_xp __attribute__((section
has_buggy_thread_startup:false,
has_fast_cwd:false,
has_restricted_raw_disk_access:false,
+ has_broken_winmm:true,
};
wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -221,6 +225,7 @@ wincaps wincap_xpsp1 __attribute__((sect
has_buggy_thread_startup:false,
has_fast_cwd:false,
has_restricted_raw_disk_access:false,
+ has_broken_winmm:true,
};
wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -261,6 +266,7 @@ wincaps wincap_xpsp2 __attribute__((sect
has_buggy_thread_startup:false,
has_fast_cwd:false,
has_restricted_raw_disk_access:false,
+ has_broken_winmm:true,
};
wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -301,6 +307,7 @@ wincaps wincap_2003 __attribute__((secti
has_buggy_thread_startup:false,
has_fast_cwd:false,
has_restricted_raw_disk_access:false,
+ has_broken_winmm:false,
};
wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -341,6 +348,7 @@ wincaps wincap_vista __attribute__((sect
has_buggy_thread_startup:true,
has_fast_cwd:true,
has_restricted_raw_disk_access:true,
+ has_broken_winmm:false,
};
wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -381,6 +389,7 @@ wincaps wincap_7 __attribute__((section
has_buggy_thread_startup:false,
has_fast_cwd:true,
has_restricted_raw_disk_access:true,
+ has_broken_winmm:false,
};
wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));
Index: wincap.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/wincap.h,v
retrieving revision 1.87
diff -u -p -r1.87 wincap.h
--- wincap.h 30 Jan 2011 21:52:12 -0000 1.87
+++ wincap.h 28 Feb 2011 20:20:10 -0000
@@ -51,6 +51,7 @@ struct wincaps
unsigned has_buggy_thread_startup : 1;
unsigned has_fast_cwd : 1;
unsigned has_restricted_raw_disk_access : 1;
+ unsigned has_broken_winmm : 1;
};
class wincapc
@@ -107,6 +108,7 @@ public:
bool IMPLEMENT (has_buggy_thread_startup)
bool IMPLEMENT (has_fast_cwd)
bool IMPLEMENT (has_restricted_raw_disk_access)
+ bool IMPLEMENT (has_broken_winmm)
#undef IMPLEMENT
};
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat