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]

Re: Cygwin GCC & JNI??

>Jim - Try the following solution.  it worked for me.   Write back if it doesn't work and I'll generate a more explicit example from my ant build script.

Alan Thompson

>From: "Mike Bresnahan" <>
>To: <>
>Subject: RE: Using cygwin and JAVA/JNI
>Date: Wed, 5 Feb 2003 22:52:17 -0800
>Importance: Normal
>I have been using Cygwin GCC 3.2 to build JNI DLLs that use <iostream>
>without difficulty.  I have done the following things:
>- put -mno-cygwin -D_REENTRANT -D_GNU_SOURCE -D__int64="long long" on the
>compiler command line
>- put -mno-cygwin -Wl,--add-stdcall-alias on the linker command line
>See the Cygwin FAQ at for info
>on -mno-cygwin.
>Mike Bresnahan
>> -----Original Message-----
>> From: []On Behalf
>> Of Alan Thompson
>> Sent: Wednesday, February 05, 2003 8:18 PM
>> To:
>> Subject: Using cygwin and JAVA/JNI
>> >
>> >Hi all - I have been doing some JNI stuff to integrate our
>> legacy software, and I have had very good luck following the
>> examples at .  The
>> only twist is that I've been using g++ instead of gcc, which
>> simplifies the non-java part.
>> >
>> >Here's a question, though:  I cannot for the life of me figure
>> out how to use the C++ <iostream> in any of the code!  For some
>> reason, the "-mno-cygwin" flag kills the ability of g++ to either
>> compile or link any code referring to <iostream>.  This means one
>> is stuck using good old printf(), instead of the more modern way.
>>  No matter how I break up the complies, it still fails at the
>> linking stage (when -mno-cygwin is still required, according to
>> my experiments).
>> >
>> >Does anyone have any ideas?  Also, I've been unable to find any
>> documentation on the -mno-cygwin flag in the gcc/g++ man pages.
>> Can anyone point me to where this comes from and/or is documented?
>> >
>> >Thanks again for all of the help,
>> >Alan Thompson
>> >
>> >P.S.  I've been using Cygwin for quite a while now ant it's
>> fantastic when you're chained to a windoze machine....

At 02:24 PM 2/17/2003 -0500, Jim Marshall wrote:
>Sorry if this is a dup, I hit send on the previous message too soon...
> First, I'm fairly new to gcc so if this isn't the right list
>plese direct me to the correct one.
> I have some code which compiles a shared object, it compiles fine
>on Red Hat 8 and even on Solaris for Intel. I'm now attempting to
>compile this same code of Windows XP using Cygwin.  This shared
>object calls functions in the java VM (jvm.dll on windows). When I
>compile on Windows I get an error stating that it can't find the
>function JNI_GetCreatedVms function. I'm sure that has to do with
>the way the jvm.dll is compiled n windows and the calling
>convention, but I can;t figure it out. I've looked for the past
>two days and havn't found that much. can anyone lend me a helping
>hand? I have search teh web and found several sources of info
>( etc..) but none have solved my problem.
>I'm using g++ 3.2 20020927 (prerelease) which came with
>cygwin (I downloaded cygwin last week).  Here is the command I am
>passing to g++ ad the output:
>g++ -Wl,--add-stdcall-alias -mno-cygwin -I. -I../common
>-Ic:/cygwin/usr/java/include -Ic:/cygwin/usr/java/include/win32
>-shared -o Tool.dll Tool.cpp  -Lc:/cygwin/usr/java/lib -ljvm 
>/cygdrive/c/temp/ccDembDG.o(.text+0x1dac):Tool.cpp: undefined
>reference to `_
>/cygdrive/c/temp/ccDembDG.o(.text+0x1e23):Tool.cpp: undefined
>reference to `_
>make: *** [NPITool.dll] Error 1
>I needthe DLL to compile with no dependency on cygwin, hence the
>-mno-cygwin. The -Wl,--add-stdcall-alias is something I just added
>after reading information at
> before
>it was just -Wall.
>Thank you

Unsubscribe info:
Bug reporting:

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