| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| X-Spam-Filter: | check_local AT alphatech DOT com 4.4(020923:1754) http://digitalanswers.org/ |
| Message-Id: | <4.3.2.7.2.20030801144049.0f67dfe8@mail.alphatech.com> |
| X-Sender: | alant AT mail DOT alphatech DOT com |
| Date: | Fri, 01 Aug 2003 14:41:43 -0700 |
| To: | "Marcus G. Daniels" <mgd AT santafe DOT edu>, cygwin AT cygwin DOT com |
| From: | Alan Thompson <athompson AT alphatech DOT com> |
| Subject: | Re: loading DLLs created with Cygwin into Sun JDK |
| In-Reply-To: | <3F29E804.6000202@santafe.edu> |
| Mime-Version: | 1.0 |
Check out this solution from the mailing list archives:
http://sources.redhat.com/ml/cygwin/2003-06/msg00357.html
Alan Thompson
At 10:09 PM 7/31/2003 -0600, Marcus G. Daniels wrote:
>I'm having a problem getting DLLs compiled with Cygwin to load into Sun JDK 1.4.1. In the past this has worked, so I hope this is fixable without too much work.
>
>Here's an example. Take a simple Java Native Interface method like this:
>
>$ cat jniTest.c
>void Java_Test_test () { printf ("test\n");}
>
>And compile it like so:
>
>gcc -shared -o jniTest.dll jniTest.c
>
>Also needed is the Java-side file:
>
>public class Test {
> public native void test ();
> public static void main (String args[]) {
> Test test = new Test ();
> System.out.println ("loading jniTest");
> System.loadLibrary ("jniTest");
> System.out.println ("calling native method");
> test.test ();
> System.out.println ("success");
> }
>}
>
>Compiled it like so from a Cygwin terminal (replace /cygdrive/i/j2sdk1.4.1_02 as appropriate):
>
>$ /cygdrive/i/j2sdk1.4.1_02/bin/javac Test.java
>
>Now run it, you should see it print "loading jniTest", but nothing more.
>
>$ CLASSPATH=. /cygdrive/i/j2sdk1.4.1_02/bin/java Test
>
>In contrast, relink the DLL, but not using "-mno-cygwin":
>
>$ gcc -mno-cygwin -shared -o jniTest.dll jniTest.c
>$ CLASSPATH=. /cygdrive/i/j2sdk1.4.1_02/bin/java Test
>
>Now it should print:
>
>loading jniTest
>calling native method
>test
>success
>
>
>
>
>--
>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/
>
--
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |