Subject: RE: problems with cygwin.dll
From: [email-masked] (Colin Peters)

30 Oct 1997 20:45:13 -0800
Message-ID: <01BCE5FA.33902280.cygnus.gnu-win32@gbird0>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
To: "'Tommy Reilly'" <[email-masked]>
Cc: "'GNU-Win32'" <[email-masked]>

Tommy Reilly[SMTP:[email-masked]] wrote:
>Well I applied gdb to my problem and got the following results.  As
>you can see from the stack trace the interpreter is calling my native
>functions fine but seg faults inside of printf.  Could it be that the
>fact that the interpreter uses all these MS libraries prevents me from
>using cygwin.dll?

It could be, though I doubt it is *directly* stopping you (although,
see the note about relocation of cygwin.dll below). On the other hand,
cygwin.dll and dlls that use it need initialization when they are
loaded into a new process (which should be done in the dll entry point
for Cygwin on a per-process/per-thread basis, and should be possible
from a dll's entry point, but not everything is in place for that
AFAIK). It may be that cygwin dll is attempting to access something
that is not properly initialized (the stdout handle comes to mind)
because java.exe is not (I presume) a Cygwin program. It may be
possible to get everything setup from within a DLL without relying
on the main program at all (it certainly *should* be), but I don't
know how.

>  Could I possibly get around this by statically
>linking the symbols I need from cygwin.dll into my dll (its the one
>called ra200.dll)?  Does that even make sense?

It sort-of makes sense. You could, I suppose, recompile the cygwin
library as a static library (though it might be harder than you
think, and might have some odd effects) and then link with that.

<PLUG>
As a totally gratuitous plug you might look at Mingw32 (see my
homepage http://www.geocities.com/Tokyo/Towers/6162/gcc.html),
which uses CRTDLL.DLL to provide the C run time and does not
appear to have any of these problems with DLL initialization.
It also seems to be thread safe, which might be an important
point in what you are doing.
</PLUG>

[snip]
>warning: LDR: Automatic DLL Relocation in java.exe
>
>warning: LDR: Dll ra200.dll base 10000000 relocated due to collision with c:\jdk1.1.4\bin\javai.dll
>
>1ef0000://I/proto/agent/lib/ra200.dll
>warning: LDR: Automatic DLL Relocation in java.exe
>
>warning: LDR: Dll cygwin.dll base 10000000 relocated due to collision with c:\jdk1.1.4\bin\javai.dll
>
>1f40000:/gnuwin32/b18/H-i386-cygwin32/bin/cygwin.dll

I know of at least one example where it seemed that problems were occurring
in a program because cygwin.dll was being relocated at load time. This may
not be the problem here (and it may be quite hard to fix under these
circumstances), but just to mention that it does cause problems sometimes.

Good luck,
Colin.

-- Colin Peters - Saga Univ. Dept. of Information Science
-- [email-masked] - finger for PGP public key
-- http://www.fu.is.saga-u.ac.jp/~colin/index.html
-- http://www.geocities.com/Tokyo/Towers/6162/

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".