This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Win2000 + JDK1.3.1_01 + JNI question

I'm trying to use Cygwin to run a Java application that uses JNI. I'm
starting with the examples from:

in particular the "c" example. The first question is about the entry
point in the DLL. I've seen references to the fact that defining an
alternate entry point for non Cygwin apps would no longer be necessary
after the beta. Is that indeed the case? If so my read is that I can
get rid of the -e,__cygwin_noncygwin_dll_entry@12 flag dllwrap.exe
arguments. Is that true?

The second question is probably due to something basic that I'm
missing. I can compile the example fine, both the native code to a DLL
and the java code to class files via javac, from a Cygwin bash prompt,
but if I try to run it it seems to hang when the java application
tries to invoke the native method. The same thing works fine from a
Windows cmd.exe prompt. Is this something I have to live with or am I
doing something incorrectly when trying to run the Java app from a
Cygwin prompt? The problem doesn't seem to manifest itself when
running a standalone Java app. Only when Java tries to call a native
method via JNI does the problem occur, and then only when I try to run
it from a Cygwin shell. Works fine, apparently, under the Win2k
command prompt.

The last question is only pertinent if I can solve the problem
described above. How to generate dll's that depend on other generated
dll's. I have a base library and another library that depends on
functions in the base library. Under Unix the sequence I use to
generate these libraries is, for example:

        gcc -shared foo.o -o
        gcc -shared bar.o -o -lfoo

But I'm stumped on how to proceed with this under Cygwin when I want
DLL's that are going to be called from a Java app via JNI.

If I create foo.dll then gcc can't find it via "-lfoo". If I create
foo.dll, via dllwrap.exe, and copy it to then the linker
core dumps. The only way I've been successful is to create
in the standard Unix way, shown above, ie., non-dll version, and then
creating foo.dll via dllwrap separately and then creating bar.dll by

Do I have to combine foo.o and bar.o into a single DLL? This is
probably doable in my project, although it creates a scary scenario
for maintenance and recompling when a change in the native source is

Thanks for any help!

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]