| Summary: | Cpp calling Fortran : C++ cout occurs before Fortran print | ||
|---|---|---|---|
| Product: | [Tools] PTP | Reporter: | FH Mising name <fh_p> |
| Component: | Photran.Debugger & Console View | Assignee: | Photran Inbox <photran-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | com-eclipse-dot-org, photran-inbox |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
As I said, I am totally new to Unix purposes (from Unix to Eclipse going throught Eclipse... Actually I investigate Eclipse to see if it can be a good alternative to VCExpress or MSDev). After creating this bug report, I realised this should have been sent to photran-inbox@eclipse.org : sorry to have bothered people not concerned by this bug. Hope you'll apologize me as this is my very first bug report ! FH PS : hope this will be redirected correctly (I added photran-inbox@eclipse.org in the Add dialog that I believe is supposed to handle this kind of things...) Thanks a lot for the bug report. Unfortunately, this behavior is out of Photran's control; it results from CDT's Console implementation, which uses a pipe to connect to the running program, which in turn causes output to be buffered in ways it wouldn't on a more typical terminal display. CDT has marked the corresponding bug report WONTFIX; their suggested workaround is to explicitly flush the output stream to ensure that the output is sequenced appropriately. Sorry there's not a better answer at this point. *** This bug has been marked as a duplicate of bug 173732 *** Thanks for replying. Since I posted this problem, I had to switch from Windows to Ubuntu : this problem does not occur with Ubuntu (same PC). I just wanted to let you know. FH |
Build Identifier: Build id: 20110615-0604 Hi, I try to call fortran from c++ : the cout of c++ occurs before the print of fortan in the Eclipse console. I believe this is a bug (and not an environnement or installation problem). Here is the Cpp.cpp file : #include <iostream> #include <string.h> using namespace std; extern "C" { void cpptofortran_ ( int const * const ipInt ); } int main () { int i = 1; cout << "C++ : " << i << endl; cpptofortran_ ( &i ); i++; cout << "C++ : " << i << endl; cpptofortran_ ( &i ); return 0; } Here is the Fortran.f90 file : subroutine cpptofortran( ipInt ) implicit none INTEGER :: ipInt print *, "FORTRAN : ", ipInt return end subroutine cpptofortran Here is the Makefile file : export CYGWIN=nodosfilewarning all: mkdir -p bin gfortran -Wall -pedantic -g3 -o0 -c Fortran.f90 -o ./bin/Fortran.o g++ -Wall -pedantic -g3 -o0 -c Cpp.cpp -o ./bin/Cpp.o g++ -Wall -pedantic ./bin/Cpp.o ./bin/Fortran.o -lgfortran -o ./bin/CppCallingFortran.exe Here are the (correct) traces I got in a (Cygwin) shell terminal : $ ./CppCallingFortran.exe C++ : 1 FORTRAN : 1 C++ : 2 FORTRAN : 2 Here are the incorrect traces I got the the Eclipse console : C++ : 1 C++ : 2 FORTRAN : 1 FORTRAN : 2 Problem : output is not ordered correctly in the Eclipse console (but is it correctly ordered the cygwin terminal) I use : 1. Windows 7 64-bits 2. Java 1.6.0_17 (Java version reported by Windows 7 : I supposed this is the same version that is used by Eclipse) 3. Eclipse 32-bits (not 64) Build id: 20110615-0604 (IDE for parallel application developpers) : I do NOT use the 32-bit version as it triggers cout problems (http://stackoverflow.com/questions/5959908/c-program-cannot-display-output-to-console-view-in-eclipse) I am experienced in programming but I am totally new to Unix related purposes (I downloaded Eclipse 2 weeks ago for the first time) : As far as I have understood, I guess this is the right place to report my problem but if I am wrong do not hesitate to tell me and to help me to redirect this to the right place (that is the place where this bug may be fixed) FH Reproducible: Always Steps to Reproduce: 1. create a C++ Makefile project 2. add the 3 file (.cpp + .f90 + Makefile) 3. run