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/

