Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28630 Discussions

Write to same stdout as application from DLL/SO. Fortran 90 standard.

Rohit_p_
Beginner
393 Views

Please bear with me as my knowledge of programming is not very good.

My application written in Fortran via a C function calls and loads up a DLL/SO. Currently the source for the DLL/SO can be C or Fortran. When I write to stdout from the DLL/SO it does not write to the same stdout as my application. Going through the forums I understood that these possible solutions can be used.

1) Use the same run time libraries for both my application and the DLL/SO.

2) Use PROCEDURES with POINTERS (not supported in Fortran90)

Is there any other possible way for this to work?

Thanks for you help. Appreciate any suggestions/comments.

0 Kudos
3 Replies
Steven_L_Intel1
Employee
393 Views

I am curious why option 2 is not acceptable to you, though I'm uncertain as to how it is applicable to your situation. What does Fortran 90 have to do with it?

Where do the various outputs go? If the executable program is a "console application" I would expect "stdout" to all go to the console. The executable and the DLLs should all link to the DLL form of the run-time libraries. If they don't, then you will have issues with I/O in that they won't share information.

0 Kudos
Arjen_Markus
Honored Contributor I
393 Views

Also note that I/O from C is independent from I/O from Fortran. Not sure how this applies to stdout, though.

Steve's question is quite relevant here: what are the differences you are trying to get rid of?

0 Kudos
mecej4
Honored Contributor III
393 Views

If stdout is buffered (most often it is, unless you have taken steps to change to line-buffering or no buffering, or you flush stdout at the right places), even if the output from the C parts and the Fortran parts reaches the console, the pieces may not arrive in logical order.

0 Kudos
Reply