<?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 You are using a compiler that in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136840#M135945</link>
    <description>&lt;P&gt;You are using a compiler that is some seven (or more!) years old. I have a vague recollection of an old issue with VALUE not being recognized from an ABSTRACT INTERFACE. Please try it with a current compiler (version 17 is current.)&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jun 2017 15:44:40 GMT</pubDate>
    <dc:creator>Steve_Lionel</dc:creator>
    <dc:date>2017-06-28T15:44:40Z</dc:date>
    <item>
      <title>Fortran 11 and probable 2003 compatibility issue</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136839#M135944</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I'm using Intel Fortran 11 to create a Fortran-Call-C piece of code&lt;/P&gt;

&lt;P&gt;I have problem when passing arguments by value from Fortran to C, and I was wondering if this may come from 2003 support issues in ifort 11&lt;/P&gt;

&lt;P&gt;The fortran sends a single argument by value&lt;/P&gt;

&lt;P&gt;ival=1 in&amp;nbsp;&lt;SPAN style="font-size: 13.008px;"&gt;CALL &amp;nbsp;p_f_i_AMETest(ival) &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;but the C function get the adress instead of the value, and print&lt;/P&gt;

&lt;P&gt;ival =1703488 in&amp;nbsp;&lt;SPAN style="font-size: 13.008px;"&gt;void AMETest(int ival)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;many thanks for any tips !!&lt;/P&gt;

&lt;P&gt;Laurent&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;This is my code&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TestDLL.cpp&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;extern "C" TESTDLL_API void AMETest(int ival) {

    printf("ival =%d\n",ival);

};&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Main.f90&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;PROGRAM main
        !DEC$ REAL:8
        USE DLLinterface

        CHARACTER*200:: dllname = 'TestDLL.dll'

        Call Test(dllname)
   
END PROGRAM&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;DLLinterface.&lt;SPAN style="font-size: 1em;"&gt;f90&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;MODULE DLLinterface
      
      USE kernel32

      USE, INTRINSIC:: iso_c_binding


      ABSTRACT INTERFACE
        SUBROUTINE f_i_AMETest(ival) BIND(C,name='AMETest')
            use iso_c_binding, only: c_int
            integer(c_int), VALUE :: ival     
        END SUBROUTINE f_i_AMETest
      END INTERFACE
      

      INTEGER(HANDLE):: handleDLL
      PROCEDURE(f_i_AMETest), POINTER:: p_f_i_AMETest     
      TYPE(C_FUNPTR):: p_c_function
      INTEGER(C_INTPTR_T):: addressCpointer
      INTEGER(C_INT):: returnedValue
    
      CONTAINS
        SUBROUTINE Test(DLLname)

            CHARACTER*200, INTENT(IN):: DLLname
            TYPE(C_FUNPTR):: p_c_function
            INTEGER(C_INTPTR_T):: addressCpointer
            INTEGER(C_INT):: returnedValue
            INTEGER(C_INT):: ival
            
            ival=1 
      
            
            handleDLL = LoadLibrary(DLLname)
            
            IF (handleDLL == NULL) THEN
                WRITE(*,*) 'DLLinterface: could not import the DLL'
            ELSE
                WRITE(*,*) 'DLLinterface: DLL imported'
            END IF
            addressCpointer = GetProcAddress(handleDLL, &amp;amp;
                                            'AMETest')
            
            !cast address to a c fonction pointer, then fortran
            CALL C_F_PROCPOINTER( &amp;amp;
                           TRANSFER(addressCpointer,p_c_function), &amp;amp;
                           p_f_i_AMETest)
  
            CALL  p_f_i_AMETest(ival)  

     
       END SUBROUTINE Test
END MODULE DLLinterface&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 14:27:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136839#M135944</guid>
      <dc:creator>laurent_l_</dc:creator>
      <dc:date>2017-06-28T14:27:53Z</dc:date>
    </item>
    <item>
      <title>You are using a compiler that</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136840#M135945</link>
      <description>&lt;P&gt;You are using a compiler that is some seven (or more!) years old. I have a vague recollection of an old issue with VALUE not being recognized from an ABSTRACT INTERFACE. Please try it with a current compiler (version 17 is current.)&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 15:44:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136840#M135945</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2017-06-28T15:44:40Z</dc:date>
    </item>
    <item>
      <title>Thanks Doctor Fortran !</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136841#M135946</link>
      <description>&lt;P&gt;Thanks Doctor Fortran !&lt;/P&gt;

&lt;P&gt;Yes I know that my version is old, but I have no other release available right now (and not sure we will buy a new one or update just for the topic I am currently working for)&lt;/P&gt;

&lt;P&gt;Any workaround possible in this case ? I really need to load a DLL because this piece of code have to be integrated in an another process.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 17:27:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136841#M135946</guid>
      <dc:creator>laurent_l_</dc:creator>
      <dc:date>2017-06-28T17:27:22Z</dc:date>
    </item>
    <item>
      <title>I don't have an 11.x compiler</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136842#M135947</link>
      <description>&lt;P&gt;I don't have an 11.x compiler available to try this myself, but let me suggest this:&lt;/P&gt;

&lt;P&gt;Try adding an explicit %VAL() in your call, as:&amp;nbsp;&amp;nbsp; &lt;FONT face="Courier New"&gt;CALL&lt;/FONT&gt;&amp;nbsp; &lt;CODE class="fortran plain"&gt;&lt;FONT face="Courier New"&gt;p_f_i_AMETest(%val(ival))&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;if that gives a compile-time error, let's try using the non-standard&amp;nbsp;directive in the abstract&amp;nbsp;routine declaration:&lt;/P&gt;

&lt;P&gt;!DEC$ ATTRIBUTES VALUE :: ival&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --Lorri&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 18:28:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136842#M135947</guid>
      <dc:creator>Lorri_M_Intel</dc:creator>
      <dc:date>2017-06-28T18:28:44Z</dc:date>
    </item>
    <item>
      <title>Great ! it has worked !</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136843#M135948</link>
      <description>&lt;P&gt;Great ! it has worked !&lt;/P&gt;

&lt;P&gt;I need to run more tests with other functions and more arguments, but I'm on the good way now :)&lt;/P&gt;

&lt;P&gt;Many thanks Lorri :)&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 18:43:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Fortran-11-and-probable-2003-compatibility-issue/m-p/1136843#M135948</guid>
      <dc:creator>laurent_l_</dc:creator>
      <dc:date>2017-06-28T18:43:25Z</dc:date>
    </item>
  </channel>
</rss>

