<?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: Common blocks and Visual C  ++ in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Common-blocks-and-Visual-C/m-p/938423#M16408</link>
    <description>You're almost there.  Add 'C' to the extern declaration of PI in your C++ code.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
    <pubDate>Fri, 09 Feb 2001 23:29:30 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2001-02-09T23:29:30Z</dc:date>
    <item>
      <title>Common blocks and Visual C  ++</title>
      <link>https://community.intel.com/t5/Software-Archive/Common-blocks-and-Visual-C/m-p/938422#M16407</link>
      <description>Ok I've read the Mixed language programming section and tried  &lt;BR /&gt;porting some legacy code with common blocks and C structures. &lt;BR /&gt;No luck.  So I tried the examples and still had no luck. &lt;BR /&gt; &lt;BR /&gt;Here is the link error from trying the examples.  It looks like your basic name mangling. &lt;BR /&gt;What compiler option settings should I look at? &lt;BR /&gt;&lt;BR /&gt;Compiling... &lt;BR /&gt;testcommon.cpp &lt;BR /&gt;Compiling Fortran... &lt;BR /&gt;F:	est	est1.for &lt;BR /&gt;Linking... &lt;BR /&gt;testcommon.obj : error LNK2001: unresolved external symbol 'double  PI' (?PI@@3NA) &lt;BR /&gt;Debug/test1.exe : fatal error LNK1120: 1 unresolved externals &lt;BR /&gt;Error executing link.exe. &lt;BR /&gt; &lt;BR /&gt;test1.exe - 2 error(s), 0 warning(s) &lt;BR /&gt; &lt;BR /&gt;Here is the test code. &lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt; 
test1.for 
  PROGRAM TEST1 
      IMPLICIT NONE 
      INTEGER*4 I 
      INTEGER*4 J 
      REAL*8 PI 
      COMMON/ PI /PI 
      INTERFACE 
         INTEGER*4 FUNCTION TESTCOMMON(N) 
         INTEGER*4 N 
         END FUNCTION TESTCOMMON 
      END INTERFACE 
      PI = DATAN(1.0D0)*4.0D0 
      WRITE(*,*)' PI IN FORTRAN = ',PI 
      J = 5 
      I = TESTCOMMON(J) 
      WRITE(*,*)' I = ',I 
 
      END 
 
testcommon.h 
 
#ifndef TESTCOMMON_H 
#define TESTCOMMON_H 
extern double PI; 
#endif 
 
testcommon.cpp 
 
#include &lt;IOSTREAM.H&gt;                // input output streams header file 
#include &lt;STDLIB.H&gt; 
#include &lt;STDIO.H&gt; 
#include 'testcommon.h'
 
extern 'C'{ int __stdcall TESTCOMMON(int*);}  
int __stdcall TESTCOMMON(int *n){ 
  int result_count = 1; 
  cout &amp;lt;&amp;lt; endl; 
  cout &amp;lt;&amp;lt; ' n = ' &amp;lt;&amp;lt; *n &amp;lt;&amp;lt; endl; 
  cout &amp;lt;&amp;lt; ' PI = ' &amp;lt;&amp;lt; PI &amp;lt;&amp;lt;  endl; 
  return(result_count); 
 
}
&lt;/STDIO.H&gt;&lt;/STDLIB.H&gt;&lt;/IOSTREAM.H&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Feb 2001 09:12:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Common-blocks-and-Visual-C/m-p/938422#M16407</guid>
      <dc:creator>Deleted_U_Intel</dc:creator>
      <dc:date>2001-02-09T09:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Common blocks and Visual C  ++</title>
      <link>https://community.intel.com/t5/Software-Archive/Common-blocks-and-Visual-C/m-p/938423#M16408</link>
      <description>You're almost there.  Add 'C' to the extern declaration of PI in your C++ code.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Fri, 09 Feb 2001 23:29:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Common-blocks-and-Visual-C/m-p/938423#M16408</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2001-02-09T23:29:30Z</dc:date>
    </item>
  </channel>
</rss>

