<?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 David, in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108167#M128639</link>
    <description>&lt;P&gt;David,&lt;/P&gt;

&lt;P&gt;That is correct. Do note that we document that there should be a space.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Dec 2015 14:30:51 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2015-12-15T14:30:51Z</dc:date>
    <item>
      <title>Correctly using DLLEXPORT and ALIAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108160#M128632</link>
      <description>&lt;P&gt;Hello, I am attempting to make use of a number of fortran functions and subroutines in a C++ project by using a generated .lib file. When compiling my C++ project, I get a linker error:&lt;/P&gt;

&lt;P&gt;error LNK2019: unresolved external symbol _Leakage_SPH referenced in function&lt;/P&gt;

&lt;P&gt;The function is called with Leakage_SPH (note no underscore), so I think this is the root of my problem. When I check the fortran code for this subroutine, I see:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;Subroutine Leakage_SPH(Nu0,FracLkgTot,tlkg,NHoles,
     +                       ObjDat, holeAreas, holeHeights)

!DEC$ATTRIBUTES DLLEXPORT, C :: Leakage_SPH
!DEC$ATTRIBUTES ALIAS : '_Leakage_SPH' :: Leakage_SPH
!DEC$ATTRIBUTES REFERENCE :: FracLkgTot&lt;/PRE&gt;

&lt;P&gt;This appears to give an alias of _Leakage_SPH so that the definition can be found. But something isn't working. The code compiles in fortran and the library is generated and placed in the correct spot. One thing I noticed is this remark that I get when compiling the fortran code:&lt;/P&gt;

&lt;P&gt;remark #5082: Directive ignored - Syntax error, found ':' when expecting one of: , &amp;lt;END-OF-STATEMENT&amp;gt; ;&lt;/P&gt;

&lt;P&gt;This appears to be pointing to my ALIAS line. Can anyone see what error I've made? Apologies if I've messed up any formatting; this is my first time posting on this forum (and indeed, my first time working with fortran at all as I usually work in C++). Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 19:56:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108160#M128632</guid>
      <dc:creator>Bennett_W_</dc:creator>
      <dc:date>2015-12-14T19:56:33Z</dc:date>
    </item>
    <item>
      <title>It looks as if you are using</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108161#M128633</link>
      <description>&lt;P&gt;It looks as if you are using the obsolete fixed-form source. Also, there should be a blank between !DEC$ and ATTRIBUTES. If you put the blank in, you'll be ok. But let me recommend to you that you use the modern free-form source. Name the file with a .f90 file type. You can have longer line lengths and if you want to continue a line, add a &amp;amp; at the end of the line to be continued. For example:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;Subroutine Leakage_SPH(Nu0,FracLkgTot,tlkg,NHoles, &amp;amp;
                            ObjDat, holeAreas, holeHeights)

!DEC$ ATTRIBUTES DLLEXPORT, C :: Leakage_SPH
!DEC$ ATTRIBUTES ALIAS : '_Leakage_SPH' :: Leakage_SPH
!DEC$ ATTRIBUTES REFERENCE :: FracLkgTot&lt;/PRE&gt;

&lt;P&gt;You can also start code in column 1 with free-form source.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 20:13:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108161#M128633</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-12-14T20:13:26Z</dc:date>
    </item>
    <item>
      <title>Thanks, Steve. Adding the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108162#M128634</link>
      <description>&lt;P&gt;Thanks, Steve. Adding the space did it. For whatever reason I just didn't notice that when I was searching for solutions earlier. Also, I am using free-form source, but I believe this code was originally written using the old form, which is why the formatting is a little odd. Regardless, it compiles fine now. Much appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 20:20:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108162#M128634</guid>
      <dc:creator>Bennett_W_</dc:creator>
      <dc:date>2015-12-14T20:20:19Z</dc:date>
    </item>
    <item>
      <title>Well, that + in column 6 of</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108163#M128635</link>
      <description>&lt;P&gt;Well, that + in column 6 of the second line is definitely fixed-form source. The source you showed would not be accepted in free-form. Glad to hear it was something simple.&lt;/P&gt;

&lt;P&gt;FWIW, the blank would be optional (though still recommended) if you used free-form source.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 20:31:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108163#M128635</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-12-14T20:31:23Z</dc:date>
    </item>
    <item>
      <title>Another problem with old code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108164#M128636</link>
      <description>&lt;P&gt;Another problem with old code is that it tends to assume 32-bit platforms. The above would fail for a 64-bit compile and link. If it were changed to&lt;/P&gt;

&lt;P&gt;!DEC$ ATTRIBUTES DECORATE, ALIAS : 'Leakage_SPH' :: Leakage_SPH&lt;/P&gt;

&lt;P&gt;I think it would be an improvement.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 21:32:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108164#M128636</guid>
      <dc:creator>JVanB</dc:creator>
      <dc:date>2015-12-14T21:32:02Z</dc:date>
    </item>
    <item>
      <title>Or if one wants to be more</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108165#M128637</link>
      <description>&lt;P&gt;Or if one wants to be more modern:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;Subroutine Leakage_SPH(Nu0,FracLkgTot,tlkg,NHoles, &amp;amp;
                            ObjDat, holeAreas, holeHeights) BIND(C,NAME="Leakage_SPH")
Use, intrinsic :: ISO_C_BINDING
!DEC$ ATTRIBUTES DLLEXPORT :: Leakage_SPH
&lt;/PRE&gt;

&lt;P&gt;You'll then need to add the VALUE attribute to the arguments that are passed by value. You didn't include those, so it would look something like:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;integer(C_INT), VALUE :: NHoles&lt;/PRE&gt;

&lt;P&gt;Fortran has extensive C interoperability features and for best portability you should use them.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 21:40:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108165#M128637</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-12-14T21:40:57Z</dc:date>
    </item>
    <item>
      <title>Steve,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108166#M128638</link>
      <description>&lt;P&gt;Steve,&lt;/P&gt;

&lt;P&gt;Is the blank between !DEC$ and ATTRIBUTES only mandatory for fixed source files?&amp;nbsp; I have been using !DEC$ATTRIBUTES in my free form files for many years.&lt;/P&gt;

&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2015 00:46:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108166#M128638</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2015-12-15T00:46:50Z</dc:date>
    </item>
    <item>
      <title>David,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108167#M128639</link>
      <description>&lt;P&gt;David,&lt;/P&gt;

&lt;P&gt;That is correct. Do note that we document that there should be a space.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2015 14:30:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Correctly-using-DLLEXPORT-and-ALIAS/m-p/1108167#M128639</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-12-15T14:30:51Z</dc:date>
    </item>
  </channel>
</rss>

