delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/01/08/16:06:18

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
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "David P. Caldwell" <inonit AT inonit DOT com>
To: <cygwin AT cygwin DOT com>
Subject: JNI/gcc problem (solved)
Date: Tue, 8 Jan 2002 16:02:06 -0500
Message-ID: <JIEPJODHFFPGJDGMCPBECEFDCHAA.inonit@inonit.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Importance: Normal

Thanks to Chuck Wilson:

In order for this to work, the --add-stdcall-alias option has to be passed
to the linker on the gcc command line.  So, referring to
http://www.inonit.com/cygwin/jni/helloWorld/c.html, the gcc command line
would need to be changed to:

gcc -mno-cygwin -I$jdk/include -I$jdk/include/win32 -Wl,--add-stdcall-alias 
-shared -o HelloWorld.dll HelloWorld.c

I'll update the online version of the tutorial as soon as I can.

-- David.
David P. Caldwell wrote:

> I was having trouble figuring out how to build Java/JNI programs with
> Cygwin.  There were a number of threads in the mailing list about it, and
> some were helpful, but it still took a great deal of slogging.
>
> After I got it working, I put a tutorial on the web
> (http://www.inonit.com/cygwin/) on how to do it.
>
> If you are an expert on these matters (and don't feel like reading the
> tutorial), one question came up.  I was unable to link my examples into
DLLs
> using gcc.  (Or, more properly, I was able to link it into a DLL, but the
> Java virtual machine would invariably complain that the function it was
> looking for did not exist.)  I ended up using LCC-Win32.  There's some
more
> information about what occurred (and my cygcheck -s output) at
> http://www.inonit.com/cygwin/jni/helloWorld/c.html.


I don't have Java installed on this machine so I can't test this myself.
  But, try the following additional options to gcc:

-Wl,--export-all-symbols

If that doesn't work, then try again with the above option, but in addition:

-Wl,--add-stdcall-alias

Does any of that help?

--Chuck


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019