problems with cygwin.dll

Colin Peters
Thu Oct 30 19:45:00 GMT 1997

Tommy Reilly[] 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.

As a totally gratuitous plug you might look at Mingw32 (see my
homepage ),
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.

>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
>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

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 Peters - Saga Univ. Dept. of Information Science
-- - finger for PGP public key

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

More information about the Cygwin mailing list