<?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 must USE the module to in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151925#M140336</link>
    <description>&lt;P&gt;You must USE the module to make its contents visible. Add USE MYMODULE to the main program, before IMPLICIT NONE.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2019 16:04:46 GMT</pubDate>
    <dc:creator>Steve_Lionel</dc:creator>
    <dc:date>2019-08-28T16:04:46Z</dc:date>
    <item>
      <title>Access subroutine inside a module using a linked library</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151924#M140335</link>
      <description>&lt;P&gt;I would like to use a subroutine written inside a static library (written in Fortran) inside a different Fortran executables.&lt;BR /&gt;This is my working example:&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;    subroutine mysum(a,b,c)
        implicit none
        real*8, intent(in)  :: a,b
        real*8, intent(out) :: c
        !
        c = a + b
        !
    end subroutine&lt;/PRE&gt;

&lt;P&gt;That generates a XXX.lib file that I am pointing at with this main:&lt;/P&gt;

&lt;PRE class="brush:fortran; class-name:dark;"&gt;program main
    implicit none
    !
    real*8 :: var1, var2
    real*8 :: out1
    !
    var1 = 15.0
    var2 = 10.0
    call somma(var1,var2,out1)
    !
    write(*,*) out1
    !
end program&lt;/PRE&gt;

&lt;P&gt;Everything is working, but the problem arise when I want to have my subroutine defined inside a module, like this:&lt;/P&gt;

&lt;PRE class="brush:fortran; class-name:dark;"&gt;module mymodule
contains
    !
    subroutine mysum(a,b,c)
        implicit none
        real*8, intent(in)  :: a,b
        real*8, intent(out) :: c
        !
        c = a + b
        !
    end subroutine
end module&lt;/PRE&gt;

&lt;P&gt;At this point the "main" compiler fails in finding the subroutine. Is there a way to let the compiler "see" the subroutine declared inside the module?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 15:53:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151924#M140335</guid>
      <dc:creator>Lorenzo_W_</dc:creator>
      <dc:date>2019-08-28T15:53:52Z</dc:date>
    </item>
    <item>
      <title>You must USE the module to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151925#M140336</link>
      <description>&lt;P&gt;You must USE the module to make its contents visible. Add USE MYMODULE to the main program, before IMPLICIT NONE.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 16:04:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151925#M140336</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-08-28T16:04:46Z</dc:date>
    </item>
    <item>
      <title>Steve, thank you for the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151926#M140337</link>
      <description>&lt;P&gt;Steve, thank you for the answer.&lt;BR /&gt;If I add "USE MYMODULE", the compiler asks me to check the include path. Should I also add the path to where the .mod files are located?&lt;BR /&gt;I hoped to "link" only the library to my main program, not also all the *.mod files.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 08:04:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151926#M140337</guid>
      <dc:creator>Lorenzo_W_</dc:creator>
      <dc:date>2019-08-29T08:04:18Z</dc:date>
    </item>
    <item>
      <title>The compiler needs to see the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151927#M140338</link>
      <description>&lt;P&gt;The compiler needs to see the .mod files to be able to check the argument list and similar things. The linker needs to see the library (the object files). Those are two distinct steps in the build process. So, what you want is not possible ;).&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 08:24:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151927#M140338</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2019-08-29T08:24:19Z</dc:date>
    </item>
    <item>
      <title>The include path is where the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151928#M140339</link>
      <description>&lt;P&gt;The include path is where the compiler looks for the .mod files, so yes, you need to add that for the main program. If you have the library as a dependent project of the main one, this happens automatically.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 12:53:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Access-subroutine-inside-a-module-using-a-linked-library/m-p/1151928#M140339</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-08-29T12:53:02Z</dc:date>
    </item>
  </channel>
</rss>

