<?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 Re: How to compile and use DLL in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499171#M166938</link>
    <description>&lt;P&gt;Dll1 code change:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;integer function myfunction(a, b)
!DEC$ ATTRIBUTES DLLEXPORT::myfunction
implicit none
      integer, value :: a, b
      myfunction = a + b
end function myfunction&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a VS Solution like Dll1 with exe fmain:&lt;/P&gt;&lt;P&gt;&amp;lt;fmain project&amp;gt;-&amp;gt;Linker-&amp;gt;Input Dll1.lib&lt;BR /&gt;&amp;lt;fmain project&amp;gt;-&amp;gt;Linker-&amp;gt;Additional Library Depencies $(SolutionDir)Dll1\$(OutDir)&lt;BR /&gt;&amp;lt;fmain project&amp;gt;-&amp;gt;Build Events-&amp;gt;PreBuild Event-&amp;gt;Command Line copy $(SolutionDir)Dll1\$(OutDir)\Dll1.dll $(SolutionDir)$(ProjectName)\$(OutDir)&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jun 2023 15:06:52 GMT</pubDate>
    <dc:creator>MWind2</dc:creator>
    <dc:date>2023-06-26T15:06:52Z</dc:date>
    <item>
      <title>How to compile and use DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499115#M166929</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I would like to use DLLs in my programs.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;In Visual Studio I compiled a simple main into his project, and in another project I compiled the function into DLL (see attached)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;When I compile main I get:&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I:\FORTRAN_INTEL_TEST\Uso_DLL\BinDbg\DLL1.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2C8&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;According to me in the properties of the main and the DLL I have not introduced the right data.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;But I don't know what they are.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;You can help me?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 10:44:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499115#M166929</guid>
      <dc:creator>moropera</dc:creator>
      <dc:date>2023-06-26T10:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to compile and use DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499147#M166935</link>
      <description>&lt;P&gt;There are many settings and check boxes in Visual studio; you have not shown us what settings you used. The following commands, executed in an Intel OneAPI command window-X64, will suffice to show that there is no problem with the source files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ifort /dll fun.f90 /link /export:MYFUNCTION
ifort main.f90 fun.lib&lt;/LI-CODE&gt;&lt;P&gt;Note that the first command generates not only the DLL that is desired, but also the import library FUN.LIB, and it is that library file that is used in the next step. Based on the error message that you reported, I wonder if you entered "FUN.DLL" where you should have entered "FUN.LIB" in the Visual Studio settings.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 13:43:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499147#M166935</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2023-06-26T13:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to compile and use DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499171#M166938</link>
      <description>&lt;P&gt;Dll1 code change:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;integer function myfunction(a, b)
!DEC$ ATTRIBUTES DLLEXPORT::myfunction
implicit none
      integer, value :: a, b
      myfunction = a + b
end function myfunction&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a VS Solution like Dll1 with exe fmain:&lt;/P&gt;&lt;P&gt;&amp;lt;fmain project&amp;gt;-&amp;gt;Linker-&amp;gt;Input Dll1.lib&lt;BR /&gt;&amp;lt;fmain project&amp;gt;-&amp;gt;Linker-&amp;gt;Additional Library Depencies $(SolutionDir)Dll1\$(OutDir)&lt;BR /&gt;&amp;lt;fmain project&amp;gt;-&amp;gt;Build Events-&amp;gt;PreBuild Event-&amp;gt;Command Line copy $(SolutionDir)Dll1\$(OutDir)\Dll1.dll $(SolutionDir)$(ProjectName)\$(OutDir)&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 15:06:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499171#M166938</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2023-06-26T15:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to compile and use DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499206#M166941</link>
      <description>&lt;P&gt;Thanks mecej4. I solved my problem with the suggestion of MWind2.&lt;/P&gt;&lt;P&gt;I appreciated your support&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 16:37:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499206#M166941</guid>
      <dc:creator>moropera</dc:creator>
      <dc:date>2023-06-26T16:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to compile and use DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499499#M166947</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thanks a lot MWind2&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;your suggestions solved my problem.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;A question:&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;The command is essential:&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;lt;fmain project&amp;gt;-&amp;gt;Build Events-&amp;gt;PreBuild Event-&amp;gt;Command Line copy $(SolutionDir)Dll1\$(OutDir)\Dll1.dll $(SolutionDir)$(ProjectName)\$(OutDir)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;because everything works even without it.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I take advantage of your kindness: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;where can I find the contents of the variables $(SolutionDir), $(OutDir) etc&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thanks again for your availability&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 09:43:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499499#M166947</guid>
      <dc:creator>moropera</dc:creator>
      <dc:date>2023-06-27T09:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to compile and use DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499551#M166951</link>
      <description>&lt;P&gt;Those variables are defined by Visual Studio based on what you have specified in the solution and project properties. For example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Steve_Lionel_0-1687870582626.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/42916iF7835B603FD1017F/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Steve_Lionel_0-1687870582626.png" alt="Steve_Lionel_0-1687870582626.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 12:56:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499551#M166951</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2023-06-27T12:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to compile and use DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499591#M166955</link>
      <description>&lt;P&gt;Thanks Lionel,&lt;/P&gt;&lt;P&gt;but I suppose I coud know which string is associated to&amp;nbsp;$(ConfigurationName) and to all the others.&lt;/P&gt;&lt;P&gt;Btw in my Properties page I've not the "User Compiler" option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sorry for my insistence&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 15:02:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499591#M166955</guid>
      <dc:creator>moropera</dc:creator>
      <dc:date>2023-06-27T15:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to compile and use DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499597#M166956</link>
      <description>&lt;P&gt;ConfigurationName is typically Debug or Release, and is selected by you before you build the project. I didn't mean to highlight "User compiler" in that screenshot.&lt;/P&gt;&lt;P&gt;In other words, these variables are taken from project and solution properties.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 15:12:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499597#M166956</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2023-06-27T15:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to compile and use DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499601#M166957</link>
      <description>&lt;P&gt;Remember that there are different Platforms whose settings are independently set, too.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 15:25:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-compile-and-use-DLL/m-p/1499601#M166957</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2023-06-27T15:25:24Z</dc:date>
    </item>
  </channel>
</rss>

