Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <005401c2a47d$921fa590$ef47fea9@calvin> From: "Frank Traenkle" To: Subject: IBM Java 13 + JNI + Cygwin fails Date: Sun, 15 Dec 2002 22:04:34 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Hi, Calling a DLL under Cygwin from IBM Java13 via JNI fails if the DLL depends on cygwin1.dll. I am using the following versions: uname -a CYGWIN_NT-5.1 CALVIN 1.3.17(0.67/3/2) 2002-11-27 18:54 i686 unknown gcc-2 --version 2.95.3-10 java -version java version "1.3.0" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0) Classic VM (build 1.3.0, J2RE 1.3.0 IBM build cn130-20020124 (JIT enabled: jitc) ) You can reproduce this with HelloWorld.java: <<< class HelloWorld { public native void displayHelloWorld(); static { System.loadLibrary("HelloWorld"); } public static void main(String[] args) { new HelloWorld().displayHelloWorld(); } } >>>EOF HelloWorld.java HelloWorld.c: <<< #include #include #include "HelloWorld.h" #include JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj) { printf("Hello world!\n"); return; } >>> EOF HelloWorld.c HelloWorld.c I compiled with gcc-2 -shared -I/cygdrive/c/Programme/IBM/Java13/include -Wl,--add-stdcall-a lias -o HelloWorld.dll HelloWorld.c "java -verbose -classpath . HelloWorld" crashes with the following output: [Running static initializer for HelloWorld] [Signaling in VM: java/lang/UnsatisfiedLinkError, message: C:\Programme\IBM\Java 13\jre\bin\HelloWorld.dll: Can't find dependent libraries] at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1470) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1346) at java.lang.Runtime.loadLibrary0(Runtime.java:766) at java.lang.System.loadLibrary(System.java:849) at HelloWorld.(HelloWorld.java:15) [Loaded java.lang.UnsatisfiedLinkError from C:\Programme\IBM\Java13\jre\lib\rt.j ar] [Loading superclasses of java/lang/UnsatisfiedLinkError] [Preparing java/lang/UnsatisfiedLinkError] [Loaded java.lang.ClassLoader$4 from C:\Programme\IBM\Java13\jre\lib\rt.jar] [Loading superclasses of java/lang/ClassLoader$4] [Preparing java/lang/ClassLoader$4] [Signaling in VM: java/lang/UnsatisfiedLinkError, message: C:\Programme\IBM\Java 13\bin\HelloWorld.dll: Can't find dependent libraries] at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1470) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1358) at java.lang.Runtime.loadLibrary0(Runtime.java:766) at java.lang.System.loadLibrary(System.java:849) at HelloWorld.(HelloWorld.java:15) Please note there are no JVM shutdown messages. Cygwin1.dll is in %PATH%. HelloWorld.dll can be loaded fine from other clients such as a MS Visual C++ with MFC. If I add -mno-cygwin when compiling, HelloWorld.dll is loaded and invoked just fine. But I need the cygwin1.dll for my project. What can I do? Frank -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/