<?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 Character string bindings, windows, linux compatability in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773201#M23660</link>
    <description>It is because your Windows compiler is old. Did Intel Fortran version 10.0 even have C interoperability? If it did, I recall there were issues with passing of characters to BIND(C) functions in earlier Intel Fortran versions. &lt;BR /&gt;&lt;BR /&gt;Your "linux" declaration is more correct - only character scalar or array entities of (LEN=1,KIND=C_CHAR) are interoperable. I don't think earlier versions of the compiler picked that up.&lt;BR /&gt;&lt;BR /&gt;Why not take a C_PTR as the return type?</description>
    <pubDate>Wed, 01 Dec 2010 22:33:08 GMT</pubDate>
    <dc:creator>IanH</dc:creator>
    <dc:date>2010-12-01T22:33:08Z</dc:date>
    <item>
      <title>Character string bindings, windows, linux compatability</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773200#M23659</link>
      <description>Hi I'm trying to write bindings for a c library that will compile in both Linux (XE 2011) and Windows (10.0.025). I have many issues that I can't seem to find help with but let me start with this one: when passing a character array windows will compile if i declare as:&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;CHARACTER(kind=gchar, len=*):: stock_id&lt;/B&gt;&lt;BR /&gt;&lt;BR /&gt;linux will compile if I declare as&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;CHARACTER(kind=gchar), dimension(*):: stock_id&lt;/B&gt;&lt;BR /&gt;&lt;BR /&gt;neither will compile if I switch them. Is this because my windows compiler is old or because of some Linux - windows difference? Thanks in Advance,&lt;BR /&gt;&lt;BR /&gt;Nate&lt;BR /&gt;&lt;BR /&gt;INTERFACE&lt;BR /&gt; FUNCTION gtk_button_new_from_stock(stock_id) bind(C,name="gtk_button_new_from_stock")&lt;BR /&gt; USE GTK_CONSTANTS, ONLY: INTPTRKIND, gchar&lt;BR /&gt; IMPLICIT NONE&lt;BR /&gt; INTEGER(KIND=INTPTRKIND):: gtk_button_new_from_stock&lt;BR /&gt; &lt;B&gt;CHARACTER(kind=gchar), dimension(*):: stock_id&lt;/B&gt;&lt;BR /&gt; ENDFUNCTION gtk_button_new_from_stock&lt;BR /&gt;ENDINTERFACE</description>
      <pubDate>Wed, 01 Dec 2010 19:07:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773200#M23659</guid>
      <dc:creator>nbunderson</dc:creator>
      <dc:date>2010-12-01T19:07:24Z</dc:date>
    </item>
    <item>
      <title>Character string bindings, windows, linux compatability</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773201#M23660</link>
      <description>It is because your Windows compiler is old. Did Intel Fortran version 10.0 even have C interoperability? If it did, I recall there were issues with passing of characters to BIND(C) functions in earlier Intel Fortran versions. &lt;BR /&gt;&lt;BR /&gt;Your "linux" declaration is more correct - only character scalar or array entities of (LEN=1,KIND=C_CHAR) are interoperable. I don't think earlier versions of the compiler picked that up.&lt;BR /&gt;&lt;BR /&gt;Why not take a C_PTR as the return type?</description>
      <pubDate>Wed, 01 Dec 2010 22:33:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773201#M23660</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2010-12-01T22:33:08Z</dc:date>
    </item>
    <item>
      <title>Character string bindings, windows, linux compatability</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773202#M23661</link>
      <description>What exactly is the error message you get? 10.0 did have C interoperability features, but had many errors. Nonetheless, the array of single-byte characters should work in both compilers. I assume that "gchar" evaluates to 1.</description>
      <pubDate>Thu, 02 Dec 2010 03:02:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773202#M23661</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-12-02T03:02:49Z</dc:date>
    </item>
    <item>
      <title>Character string bindings, windows, linux compatability</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773203#M23662</link>
      <description>Below I've included the relevant definition, routine call, interface and error.&lt;BR /&gt;&lt;BR /&gt;!**************************************************************************&lt;BR /&gt;CHARACTER*30, PARAMETER :: GTK_STOCK_FIND = "gtk-find"//char(0)&lt;BR /&gt;&lt;BR /&gt;INTERFACE&lt;BR /&gt; FUNCTION gtk_button_new_from_stock(stock_id) bind(C,name="gtk_button_new_from_stock")&lt;BR /&gt; USE GTK_CONSTANTS, ONLY: INTPTRKIND, gchar&lt;BR /&gt; IMPLICIT NONE&lt;BR /&gt; INTEGER(KIND=INTPTRKIND):: gtk_button_new_from_stock&lt;BR /&gt; CHARACTER(KIND=gchar),dimension(*):: stock_id&lt;BR /&gt; ENDFUNCTION gtk_button_new_from_stock&lt;BR /&gt;ENDINTERFACE&lt;BR /&gt;&lt;BR /&gt;button = gtk_button_new_from_stock (GTK_STOCK_ADD);&lt;BR /&gt;&lt;BR /&gt;!**************************************************************************&lt;BR /&gt;&lt;BR /&gt;I didn't realize this before but if I simply remove the PARAMETER attribute everything works.&lt;BR /&gt;&lt;BR /&gt;!**************************************************************************&lt;BR /&gt;CHARACTER*30  :: GTK_STOCK_FIND = "gtk-find"//char(0)&lt;BR /&gt;!**************************************************************************&lt;BR /&gt;&lt;BR /&gt;Sorry I didn't check that before. I'm not sure why I can't do that but I don't mind dropping PARAMETER&lt;BR /&gt;&lt;BR /&gt;On another topic, I guess I should buy a new windows compiler eh? If it's known to have a lot of interoperability issues then maybe it's the cause of a lot of my headaches :).&lt;BR /&gt;&lt;BR /&gt;Nate&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Dec 2010 05:47:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773203#M23662</guid>
      <dc:creator>nbunderson</dc:creator>
      <dc:date>2010-12-02T05:47:00Z</dc:date>
    </item>
    <item>
      <title>Character string bindings, windows, linux compatability</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773204#M23663</link>
      <description>forgot to include the error message...&lt;BR /&gt;&lt;BR /&gt;Error 2  Error: 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. [NAME] sourceviewwindow.f90 882 &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Dec 2010 05:48:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773204#M23663</guid>
      <dc:creator>nbunderson</dc:creator>
      <dc:date>2010-12-02T05:48:07Z</dc:date>
    </item>
    <item>
      <title>Character string bindings, windows, linux compatability</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773205#M23664</link>
      <description>A few last things, in the above post I grabbed the wrong variable, should be:&lt;BR /&gt;&lt;BR /&gt;CHARACTER*30 :: GTK_STOCK_ADD = "gtk-add"//char(0)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also, even if I leave the character string as a parameter the code compiles if I trim the variable&lt;BR /&gt;
&lt;BR /&gt;
!************************************************************&lt;BR /&gt;
button = gtk_button_new_from_stock (trim(GTK_STOCK_ADD));&lt;BR /&gt;
!************************************************************&lt;BR /&gt;
WORKS&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
also if you hard code the string but forget the null termination&lt;BR /&gt;
&lt;BR /&gt;
!********************************************************&lt;BR /&gt;
button = gtk_button_new_from_stock ("gtk-add")&lt;BR /&gt;
!********************************************************&lt;BR /&gt;
DOESN"T WORK SAME ERROR&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
!********************************************************&lt;BR /&gt;

button = gtk_button_new_from_stock ("gtk-add"//char(0))&lt;BR /&gt;

!********************************************************&lt;BR /&gt;
WORKS</description>
      <pubDate>Thu, 02 Dec 2010 05:59:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773205#M23664</guid>
      <dc:creator>nbunderson</dc:creator>
      <dc:date>2010-12-02T05:59:25Z</dc:date>
    </item>
    <item>
      <title>Character string bindings, windows, linux compatability</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773206#M23665</link>
      <description>This all works correctly in 12.0.</description>
      <pubDate>Thu, 02 Dec 2010 16:08:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Character-string-bindings-windows-linux-compatability/m-p/773206#M23665</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-12-02T16:08:33Z</dc:date>
    </item>
  </channel>
</rss>

