<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Steve: in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152958#M140715</link>
    <description>&lt;P&gt;Steve:&lt;/P&gt;&lt;P&gt;Thank you very much. More I thought about it more I realized how stupid my&amp;nbsp;idea is. In addition to the different data structure created by different compilers, and the data structures and entry points used by different libraries&amp;nbsp;in different operating systems would be a nightmare to synchronize.&lt;/P&gt;&lt;P&gt;Thank you again for your prompt and wise advice. I have started on a different design by moving all my file IO to&amp;nbsp;C++ which will require some work to strip parts of my legacy code.&lt;/P&gt;&lt;P&gt;I. Konuk&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Aug 2019 19:56:50 GMT</pubDate>
    <dc:creator>Ibrahim_K_</dc:creator>
    <dc:date>2019-08-30T19:56:50Z</dc:date>
    <item>
      <title>Sharing files between C++ and Intel Fortran</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152956#M140713</link>
      <description>&lt;P&gt;Friends;&lt;/P&gt;&lt;P&gt;I would like to open files for input and output (not the same file) in C++ and write or read from them in a subroutine linked with a C++ main program.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I can open files in Fortran in a C++/Fortran program using the standard file management functions without messing up the files used by C++ main. But I am suspicious that I will mess up files&amp;nbsp;if I tried to do that with a file already open in C++.&lt;/P&gt;&lt;P&gt;Is there a simple solution to this problem?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I. Konuk&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 17:32:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152956#M140713</guid>
      <dc:creator>Ibrahim_K_</dc:creator>
      <dc:date>2019-08-29T17:32:16Z</dc:date>
    </item>
    <item>
      <title>You are correct - trying to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152957#M140714</link>
      <description>&lt;P&gt;You are correct - trying to open the same file simultaneously in Fortran and C++ will create problems. Don't do this. Call a routine in whichever language opened the file to read or write it.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 00:12:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152957#M140714</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-08-30T00:12:11Z</dc:date>
    </item>
    <item>
      <title>Steve:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152958#M140715</link>
      <description>&lt;P&gt;Steve:&lt;/P&gt;&lt;P&gt;Thank you very much. More I thought about it more I realized how stupid my&amp;nbsp;idea is. In addition to the different data structure created by different compilers, and the data structures and entry points used by different libraries&amp;nbsp;in different operating systems would be a nightmare to synchronize.&lt;/P&gt;&lt;P&gt;Thank you again for your prompt and wise advice. I have started on a different design by moving all my file IO to&amp;nbsp;C++ which will require some work to strip parts of my legacy code.&lt;/P&gt;&lt;P&gt;I. Konuk&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 19:56:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152958#M140715</guid>
      <dc:creator>Ibrahim_K_</dc:creator>
      <dc:date>2019-08-30T19:56:50Z</dc:date>
    </item>
    <item>
      <title>Quote:Steve Lionel (Ret.)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152959#M140716</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Steve Lionel (Ret.) (Blackbelt) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are correct - trying to open the same file simultaneously in Fortran and C++ will create problems. Don't do this. Call a routine in whichever language opened the file to read or write it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve, since you said "read or write", then what would happen, if the same file is opened on multiple coarray images? Does the Fortran standard say anything about this scenario. I ask, because I have written codes in the past that read the same file simultaneously from multiple images (no writing happens though), and it has so far worked with no problems.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 22:16:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152959#M140716</guid>
      <dc:creator>DataScientist</dc:creator>
      <dc:date>2019-09-03T22:16:00Z</dc:date>
    </item>
    <item>
      <title>Prior to Fortran 2018,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152960#M140717</link>
      <description>&lt;P&gt;Prior to Fortran 2018, opening the same file in multiple images was not allowed by the standard. In Fortran 2018, it is "processor-dependent", meaning you're not breaking the standard doing so, but the results are unspecified.&lt;/P&gt;&lt;P&gt;I'll note that the standard encourages implementations to "merge" standard output streams from images to image 1, but this is not a requirement. Standard input is preconnected on image 1 only.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 00:29:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152960#M140717</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-09-04T00:29:55Z</dc:date>
    </item>
    <item>
      <title>It is years since I started</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152961#M140718</link>
      <description>&lt;P&gt;It is years since I started to exchange data between Fortran simulation executables and the C++ windows interface using the same files.&lt;/P&gt;&lt;P&gt;There is nothing which prohibits such use. You have only to apply the correct OPEN parameters to assure the cooperation of the software executables.&lt;/P&gt;&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 09:32:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152961#M140718</guid>
      <dc:creator>LRaim</dc:creator>
      <dc:date>2019-09-04T09:32:51Z</dc:date>
    </item>
    <item>
      <title>There may be "nothing which</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152962#M140719</link>
      <description>&lt;P&gt;There may be "nothing which prohibits such use", but whether it does what you want is not guaranteed. Having a file opened in two languages at once may be a problem due to buffering and tracking of file position.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 18:39:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152962#M140719</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-09-04T18:39:20Z</dc:date>
    </item>
    <item>
      <title>Post #6 uses plural</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152963#M140720</link>
      <description>&lt;P&gt;Post #6 uses plural "executables".&amp;nbsp; Is that because the Fortran and C++ bits are in different executables?&amp;nbsp; If so, that's a different case to the original post, where there is a single executable, that has both Fortran and C++ code operating on a common file (which is likely to be problematic).&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 17:01:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152963#M140720</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2019-09-05T17:01:21Z</dc:date>
    </item>
    <item>
      <title>Either way it's likely to be</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152964#M140721</link>
      <description>&lt;P&gt;Either way it's likely to be a problem as I don't think Windows shares file positions across processes. I'll note that any sequential write from Fortran truncates the file at the current position.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 18:41:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152964#M140721</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-09-05T18:41:02Z</dc:date>
    </item>
    <item>
      <title>Quote:IanH (Blackbelt) wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152965#M140722</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;IanH (Blackbelt) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Post #6 uses plural "executables".&amp;nbsp; Is that because the Fortran and C++ bits are in different executables?&amp;nbsp; If so, that's a different case to the original post, where there is a single executable, that has both Fortran and C++ code operating on a common file (which is likely to be problematic).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, the same file is processed at the same time by one executable written in C++ and one in Fortran.&lt;/P&gt;&lt;P&gt;If two pieces of code (C++ and Fortran) are in the same executable, information sharing between the C++ section and the Fortran section&amp;nbsp; would be more simple.&lt;/P&gt;&lt;P&gt;Files are objects defined by the operating system not by a language. So the language makes available the input/output functions on a file allowed by the operating system.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 20:30:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152965#M140722</guid>
      <dc:creator>LRaim</dc:creator>
      <dc:date>2019-09-05T20:30:41Z</dc:date>
    </item>
    <item>
      <title>Yes, but the language has its</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152966#M140723</link>
      <description>&lt;P&gt;Yes, but the language has its own rules of how I/O operations in the language translate to calls to the OS. The language library may build up buffers and write things when it feels it needs to, and a write in one language may not be immediately seen by a read in the other.&lt;/P&gt;&lt;P&gt;It's never a good idea to do mixed-language I/O.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 23:39:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152966#M140723</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-09-05T23:39:02Z</dc:date>
    </item>
    <item>
      <title>I dared and decided to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152967#M140724</link>
      <description>&lt;P&gt;I dared and decided to experiment with a partial version of doing I/O (only WRITE)&amp;nbsp;from both parts of C++/Fortran program and I found a trap or bug.&lt;/P&gt;&lt;P&gt;It works mostly if one outputs to separate files not shared by Fortran and C++. However, if one decides to do some fancy thing, C++ gives exception.&lt;/P&gt;&lt;P&gt;The fancy thing I am referring to in my case is that if I decide to redirect std::cout to a file stream, I get exception even I close the file in Fortran before doing so. When I find some time I will do a small example and post it here.&lt;/P&gt;&lt;P&gt;This example validates the advice given by Steve; do not mess I/O in mixed code! I though I share it here.&lt;/P&gt;&lt;P&gt;I. Konuk&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 21:44:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Sharing-files-between-C-and-Intel-Fortran/m-p/1152967#M140724</guid>
      <dc:creator>Ibrahim_K_</dc:creator>
      <dc:date>2019-09-16T21:44:52Z</dc:date>
    </item>
  </channel>
</rss>

