delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/03/11/20:12:57

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.20030311170553.0317bac8@mail.alphatech.com>
X-Sender: alant AT mail DOT alphatech DOT com
Date: Tue, 11 Mar 2003 17:12:46 -0800
To: cygwin AT cygwin DOT com
From: Alan Thompson <athompson AT alphatech DOT com>
Subject: Re: Standard out writes fail after cygwin generated dll loaded
In-Reply-To: <F341O0aAGgWtpe1OWhM00006a1e@hotmail.com>
Mime-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h2C1CuV15762

I have not experienced this problem.  I am using Cygwin to build a JNI .dll file, and regularly use both the cerr output stream from the c++ side and the System.err.println() output function from the java side. Note that I am always running from a Cygwin window.

If you have not seen it, you should try visiting the excellend Cygwin/JNI website at:  http://www.inonit.com/cygwin/  Note also that you don't need to use the -mno-cygwin hack (perhaps this is related to your problems?).  Here is a part of my ant build script (I use the normal Cygwin g++ for builds).

  <target name="ccCompCygwin" > 
    <exec executable="${cppCompilerName}" dir="${ctmp}" > 
      <arg line=" -D_REENTRANT -D_GNU_SOURCE -D__int64='long long' "  /> 
      <arg line=" -I${env.JAVA_HOME}/include " /> 
      <arg line=" -I${env.JAVA_HOME}/include/win32 " /> 
      <arg line=" -I${ctmp} " /> 
      <arg line=" -c " /> 
      <arg line=" Globals.c " /> 
      .....
    </exec> 
  </target> 

  <target name="ccLinkCygwin" > 
    <exec executable="${cppCompilerName}" dir="${ctmp}" > 
      <arg line=" -Wl,--add-stdcall-alias -shared" /> 
      <arg line="-I${env.JAVA_HOME}/include" /> 
      <arg line="-I${env.JAVA_HOME}/include/win32" /> 
      <arg line="  " /> 
      <arg line=" -o ${bin}/Native.dll " /> 
      <arg line=" Globals.o" /> 
      .......
    </exec> 
  </target> 

Alan Thompson


At 12:18 PM 3/7/2003 +0100, José Lorenzo Mon wrote:

>Hi Luis and All,
>
>>When trying to run through the JNI native C code compiled in a DLL
>>using Cygwin, I found that standard Java output stops to work as
>>soon as the DLL is loaded. However, if the same code is compiled
>>without Cygwing (-mno-cygwin) the Java output works OK after and
>>before loading the DLL.
>
>I am having same problem. My tests more in detail:
>
>- When running the Java VM *from a cygwin shell*, the stdout channel
>works OK before and after loading the DLL generated with the cygwin
>gcc. However, the stderr stops working after loading the DLL.
>After loading the DLL and using the stdout and stderr
>channels by the native C function, the Java program is only able to use
>the stdout channel.
>
>- When running the Java VM *from a windows shell*, both the stdout and
>stderr channels stop working after loading the DLL.
>
>- When compiling the dll *without* cygwin support (with the
>"-mno-cygwin" flag), both channels work ok in both shells.
>
>- The version employed of "jni.h" does not seem to affect to the
>results. I have tried both versions, the one comming with cygwin and
>the version provided with the JDK distribution (defining by
>myself __int64).
>
>- The version of the JDK (1.3 or 1.4) does not seem to affect to the
>results.
>
>- I have tried with different combination of flags for the gcc compiler
>and they do not seem to affect to the results.
>
>
>Does anyone know why this is happening or a possible solution?
>
>Thanks in advance,
>
>      Jose
>
>
>
>_________________________________________________________________
>Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
>http://join.msn.com/?page=features/junkmail
>
>
>--
>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/
>



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