<?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: compiler directives with C++ in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/compiler-directives-with-C/m-p/883466#M75993</link>
    <description>As stdcall is an obsolete ABI, support for it is not available in all Fortran compilers, nor is there a compatible default in those that have supported it in the last 5 years. I suspect you haven't attempted to turn it on on the Fortran side, nor would I recommend you try it. You don't show any motivation for avoiding Fortran 2003 C Interoperability method. If, for some reason, you don't want to use ISO C Interoperability, you still ought to avoid stdcall.&lt;BR /&gt;</description>
    <pubDate>Fri, 19 Sep 2008 00:29:33 GMT</pubDate>
    <dc:creator>TimP</dc:creator>
    <dc:date>2008-09-19T00:29:33Z</dc:date>
    <item>
      <title>compiler directives with C++</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/compiler-directives-with-C/m-p/883465#M75992</link>
      <description>&lt;P&gt;I'm trying to write a basic program in C++ that calls a routine and a function from Fortran. I found this example on the web ( &lt;A href="http://www.neurophys.wisc.edu/comp/docs/notes/not017.html"&gt;http://www.neurophys.wisc.edu/comp/docs/notes/not017.html&lt;/A&gt;) and have been trying to duplicate it. I'm getting three errors when I try to build:&lt;/P&gt;
&lt;P&gt;error: LNK2019: unresolved external symbol _Main__ referenced in function_main (coming from Fortran project)&lt;/P&gt;
&lt;P&gt;error: LNK2019: unresolved external symbol &lt;A href="mailto:_FF1@4"&gt;_FF1@4&lt;/A&gt; reference in function_main (coming from C++ project)&lt;/P&gt;
&lt;P&gt;error: LNK2019: unresolved external symbol &lt;A href="mailto:_FR1@8"&gt;_FR1@8&lt;/A&gt; reference in function_main (coming from C++ project)&lt;/P&gt;
&lt;P&gt;My directives look like this for my subroutine:&lt;/P&gt;&lt;FONT color="#008000" size="2"&gt;&lt;FONT color="#008000" size="2"&gt;
&lt;P&gt;&lt;STRONG&gt;!DEC$ ATTRIBUTES DLLEXPORT ::FR1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;!DEC$ ATTRIBUTES STDCALL, ALIAS : '_FR1@8' :: FR1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;And this for my function(which is in the subroutine)&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color="#008000" size="2"&gt;&lt;FONT color="#008000" size="2"&gt;
&lt;P&gt;&lt;STRONG&gt;!DEC$ ATTRIBUTES DLLEXPORT :: FF1 &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;!DEC$ ATTRIBUTES STDCALL, ALIAS : '_FF1@4' :: FF1 &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;C++ section looks like this:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;extern&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; "C" &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;_stdcall&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; FR1(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;*,&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; *);&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;extern&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; "C" &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;_stdcall&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; FF1(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; *);&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; main()&lt;P&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; n=10,nSq,nCube;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;FR1(&amp;amp;n,&amp;amp;nSq);&lt;/P&gt;
&lt;P&gt;nCube=FF1(&amp;amp;n); &lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Chris&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description>
      <pubDate>Thu, 18 Sep 2008 20:24:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/compiler-directives-with-C/m-p/883465#M75992</guid>
      <dc:creator>cfann61</dc:creator>
      <dc:date>2008-09-18T20:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: compiler directives with C++</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/compiler-directives-with-C/m-p/883466#M75993</link>
      <description>As stdcall is an obsolete ABI, support for it is not available in all Fortran compilers, nor is there a compatible default in those that have supported it in the last 5 years. I suspect you haven't attempted to turn it on on the Fortran side, nor would I recommend you try it. You don't show any motivation for avoiding Fortran 2003 C Interoperability method. If, for some reason, you don't want to use ISO C Interoperability, you still ought to avoid stdcall.&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2008 00:29:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/compiler-directives-with-C/m-p/883466#M75993</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2008-09-19T00:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: compiler directives with C++</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/compiler-directives-with-C/m-p/883467#M75994</link>
      <description>I'm not really in agreement that STDCALL is obsolete - it is the ONLY method available for calls to the Win32 API and from VB, EXCEL, managed code, etc.&lt;BR /&gt;&lt;BR /&gt;There is at least one problem you have in that the Fortran project is looking for a main program. This means that either you created the Fortran project as an executable application (Console, etc.) rather than static library, or you have run into a bug in older versions of Intel Visual Fortran where every source got linked. Most likely the former.&lt;BR /&gt;&lt;BR /&gt;You want to create a static library project for the Fortran code and make it a "dependent" of the C++ project. (If you have VS2005, make sure it also has SP1 applied.) In the Fortran project, set the property Libraries &amp;gt; Disable default library search rules to "No". Under Tools &amp;gt; Options &amp;gt; Projects &amp;gt; VC++ Directories, add the path to the Fortran installation LIB folder to "Library Files".&lt;BR /&gt;&lt;BR /&gt;If in fact you have done all of these but still get the Fortran code linked, in the Fortran project go to the Fortran &amp;gt; Command Line property page and add /c to the Additional Options text.&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2008 00:48:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/compiler-directives-with-C/m-p/883467#M75994</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-09-19T00:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: compiler directives with C++</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/compiler-directives-with-C/m-p/883468#M75995</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;I was initializing everything as console applications. Working fine now.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Sep 2008 14:50:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/compiler-directives-with-C/m-p/883468#M75995</guid>
      <dc:creator>cfann61</dc:creator>
      <dc:date>2008-09-23T14:50:16Z</dc:date>
    </item>
  </channel>
</rss>

