<?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 Platform dependant behaviour with BIND(C) in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757578#M13065</link>
    <description>If he modified the interface as you suggest, Jim, it would be detected as an error by a newer version and would be non-standard.</description>
    <pubDate>Thu, 08 Sep 2011 16:15:07 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2011-09-08T16:15:07Z</dc:date>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757568#M13055</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I have inherited a C++ and Fortran model that was originally written for Windows and I am trying to port to Linux. I'm not particularly experienced with Fortran and having some problems with that side. Had hoped that using the linux complier on both platforms would mean the fortran problems would be slight. The following coding pattern worked using the Intel Windows complier, however fails to complie on the Intel Linux complier.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[fortran]Module Test

INTERFACE
        SUBROUTINE GTitle(STRING) BIND(C)
        USE,INTRINSIC :: ISO_C_BINDING
                CHARACTER(KIND=C_CHAR), DIMENSION(*) :: STRING [REFERENCE]
        END SUBROUTINE
END INTERFACE

contains

Subroutine SubTest()
        Call GTitle('Some Name'C)
End Subroutine SubTest

End Module Test
[/fortran]&lt;/PRE&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;On linux I get the following:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV id="_mcePaste"&gt;ifort -od -fpp -openmp_stubs -align rec1byte -align commons -assume byterecl -mixed_str_len_arg -traceback -threads -c Test2.f90&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Test2.f90(13): error #7836: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element.  [STRING]&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;	Call GTitle('Some Name'C)&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;-------------^&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;compilation aborted for Test2.f90 (code 1)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;ifort -od -fpp -openmp_stubs -align rec1byte -align commons -assume byterecl -mixed_str_len_arg -traceback -threads -c Test2.f90Test2.f90(13): error #7836: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element.  [STRING]	Call GTitle('Some Name'C)-------------^compilation aborted for Test2.f90 (code 1)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Any assistance would be much appreciated.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;&lt;DIV&gt;Peter&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Sep 2011 17:43:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757568#M13055</guid>
      <dc:creator>alexanpe99</dc:creator>
      <dc:date>2011-09-06T17:43:21Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757569#M13056</link>
      <description>I can't reproduce this - which compiler version are you using? ifort -V will tell you. I would be very surprised by a platform difference in this area.</description>
      <pubDate>Tue, 06 Sep 2011 19:27:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757569#M13056</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-09-06T19:27:50Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757570#M13057</link>
      <description>&lt;DIV id="_mcePaste"&gt;Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.0  Build 20090131 Package ID: l_cprof_p_11.0.081&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Sep 2011 19:43:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757570#M13057</guid>
      <dc:creator>alexanpe99</dc:creator>
      <dc:date>2011-09-06T19:43:51Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757571#M13058</link>
      <description>That's pretty old. Can you try a newer one? Which version is your Windows system using?</description>
      <pubDate>Tue, 06 Sep 2011 20:45:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757571#M13058</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-09-06T20:45:12Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757572#M13059</link>
      <description>&lt;P class="p1"&gt;Not easy to upgrading on Linux as I'm just a user on a large infrastructure, however I will put in a request for a newer version to be made avaliable. On Windows it was ComposerXE-2011 installed around April.&lt;/P&gt;
&lt;P class="p1"&gt;However it appears that part (perhaps all) of the problem may be due to unnecessaryDimension(*). If this is removed it complies (and initial indications is works at run time) on both platforms.&lt;/P&gt;
&lt;P class="p1"&gt;Still doesn't explain the platform differences, if it works them I'm happy.&lt;/P&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Sep 2011 15:51:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757572#M13059</guid>
      <dc:creator>alexanpe99</dc:creator>
      <dc:date>2011-09-07T15:51:27Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757573#M13060</link>
      <description>Probably not platform differences, as much as compiler-version differences.&lt;BR /&gt;&lt;BR /&gt;That is, we fixed something in the Composer XE 2011 version that was broken in the older compiler (from 2009)&lt;BR /&gt;&lt;BR /&gt; -- Lorri</description>
      <pubDate>Wed, 07 Sep 2011 17:09:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757573#M13060</guid>
      <dc:creator>Lorri_M_Intel</dc:creator>
      <dc:date>2011-09-07T17:09:56Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757574#M13061</link>
      <description>Wouldn't you want:&lt;BR /&gt;&lt;BR /&gt;CHARACTER(KIND=C_CHAR, LEN=*) :: STRING ! [REFERENCE]&lt;BR /&gt;&lt;BR /&gt;*** note the ! before [REFERENCE]&lt;BR /&gt;&lt;BR /&gt;The way you had it declared would have specified was for an array of 1 character elements (size of array assumed), *** and as a coarray of size = REFERENCE (?undeclared parameter).&lt;BR /&gt;&lt;BR /&gt;The above declares a scalar character variable of assumed length.&lt;BR /&gt;&lt;BR /&gt;Your "Call GTitle('Some Name'C)" is passing a scalar character variable of length 9 (10 w/NULL)&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey</description>
      <pubDate>Wed, 07 Sep 2011 17:26:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757574#M13061</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2011-09-07T17:26:26Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757575#M13062</link>
      <description>No - for an "interoperable" procedure, an array of length 1 character is correct. There is no REFERENCE attribute in standard Fortran.&lt;BR /&gt;&lt;BR /&gt;The Fortran standard carefully specifies that a character (any length argument) can be passed to a character(1) array - this is an exception to the rule that normally forbids passing scalars to arrays.&lt;BR /&gt;&lt;BR /&gt;To be honest, I would be somewhat astonished that we ever had such a bug, as this is a major item in the C interoperabilty features we introduced in 10.0, but I suppose anything is possible...</description>
      <pubDate>Wed, 07 Sep 2011 23:04:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757575#M13062</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-09-07T23:04:36Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757576#M13063</link>
      <description>&amp;gt;&amp;gt;No - for an "interoperable" procedure, an array of length 1 character is correct.&lt;BR /&gt;&lt;BR /&gt;However, the user is seeing the error message complaining about a FORTRAN'scalar'C passed to a FORTRAN subroutine declared taking an array. Although this is a valid FORTRAN standards call, their IVF is in error reporting this (a bug in their older version of IVF). Further the user's C (C++) code is not going to see the FORTRAN INTERFACE. Therefore to keep the user's version of IVF "happy" they can declare the FORTRAN INTERFACE differently (without affecting the C/C++ side of the application). Alternativley they could buy an update.&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey</description>
      <pubDate>Thu, 08 Sep 2011 15:29:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757576#M13063</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2011-09-08T15:29:38Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757577#M13064</link>
      <description>Got access to 12.0 and indeed the problem is not seen in that complier version. I'm therefore presuming it would be best to keep the fortran interface declaration as per the original code. Thanks for all your help.</description>
      <pubDate>Thu, 08 Sep 2011 15:39:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757577#M13064</guid>
      <dc:creator>alexanpe99</dc:creator>
      <dc:date>2011-09-08T15:39:12Z</dc:date>
    </item>
    <item>
      <title>Platform dependant behaviour with BIND(C)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757578#M13065</link>
      <description>If he modified the interface as you suggest, Jim, it would be detected as an error by a newer version and would be non-standard.</description>
      <pubDate>Thu, 08 Sep 2011 16:15:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Platform-dependant-behaviour-with-BIND-C/m-p/757578#M13065</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-09-08T16:15:07Z</dc:date>
    </item>
  </channel>
</rss>

