Subject: Re: Dynamic loading of cygwin dependent dlls
From: "Gerrit P. Haase" <[email-masked]>
To: "Peter Ekberg" <[email-masked]>
Cc: [email-masked]
Date: Wed, 11 Aug 2004 15:45:59 +0200

Hello Peter,

>> > Ah, now I see it. You have to be careful with your typing.
>> > pseudo_stubs.dll (with one s in the end) is the name that fails.
>> > Apparently both pseudo_stub.dll (no s) and psuedo_stubs.dll (bad
>> > spelling) work. And pseudo_stubss.dll (double s) definitely 
>> works, that
>> > I have tried myself.
>> 
>> You have checked what error 998 actually is?
>> 
>> #define ERROR_NOACCESS 998L

> Of course. I have also checked what might cause the error. See:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;q196069

> I can also say that I have tried to use the pure Win32 LoadLibrary call
> on the resulting dlls, and the results are consistent with the dlopen
> results. My guess is that there is something wrong inside the dll, that
> causes a segfault during dlopen/LoadLibrary.

>> I cannot believe that it depends on the name of a DLL whether it can
>> be dlopened or not.

> Me neither, yet the name appears to be significant in some way.

Then it is a bug in dlltool or dllwrap and I wonder why this never was
fixed.

>>                      There must be another error with your test!
>> 
>> Consider this (with source from your first posting):
>> $ gcc -shared -o pseudo_stubs.dll foo.c
>> $ gcc -o load load.c
>> $ ./load
>> pseudo_stubs.dll        ok
>> foo.dll dlopen: Win32 error 126
>> $ cp pseudo_stubs.dll foo.dll
>> $ ./load
>> pseudo_stubs.dll        ok
>> foo.dll ok

> Hey, that doesn't explain anything. It's like answering someones awk bug
> report with "see, it works with sed, your test must be wrong". Apart
> from that, thanks for the example, the project now uses "gcc -shared"
> with apparent success. So for me, this problem is now academic.

That is what I wanted to achieve with this example.

> I'm not saying that it is the name of the dll that is causing the
> problem. If I build the dll as foo.dll with dlltool/dllwrap and rename
> it to pseudo_stubs.dll, pseudo_stubs.dll works. Also, if I build the dll
> as pseudo_stubs.dll and rename it foo.dll, foo.dll doesn't work.

> I'd say that there is some sort of problem in dlltool/dllwrap. Please
> enlighten me if I'm using them incorrectly.

Seems to be really a bug.

> Can someone also please say if they get error 998 for the example in the
> original post, or if that happens on my machine only.

Indeed I get the same error and it works if I use foo instead of
pseudo_stubs, maybe it is really the underscore?  Since the -shared
switch for gcc works pretty well and since then, dlltool and dllwrap
are kind of deprecated, it is up to you to figure out what is wrong
with dlltool/dllwrap and fix it if you really need it.

Gerrit
-- 
=^..^=

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/