<?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: Exchanging data between common block and C struct in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Exchanging-data-between-common-block-and-C-struct/m-p/976527#M25110</link>
    <description>It would be helpful to see a test case that &lt;B&gt;doesn't&lt;/B&gt; work...&lt;BR /&gt;&lt;BR /&gt;Steve</description>
    <pubDate>Sat, 08 Dec 2001 01:39:35 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2001-12-08T01:39:35Z</dc:date>
    <item>
      <title>Exchanging data between common block and C struct</title>
      <link>https://community.intel.com/t5/Software-Archive/Exchanging-data-between-common-block-and-C-struct/m-p/976526#M25109</link>
      <description>I am porting legacy code from a Sun with mixed Fortran and C. I am trying &lt;BR /&gt;to exchange data between a Fortran common block and a C struct( VC++ 6.0). I keep &lt;BR /&gt;getting linker error mesages like: &lt;BR /&gt; &lt;BR /&gt;error LNK2001: unresolved external symbol _COM1 &lt;BR /&gt; &lt;BR /&gt;I have read the help files and set up a test case that follows their guidelines. &lt;BR /&gt;(See below). This test case works.  I am sure I have set up the common blocks and structs exactly &lt;BR /&gt;like this example but I keep getting the error messages when I try to link &lt;BR /&gt;my code which . Any suggestions as to why my code won't link even though it is structured &lt;BR /&gt;like the following example? &lt;BR /&gt; &lt;BR /&gt;The C modules are C, not C++. The Fortran is a quickwin project. &lt;BR /&gt; &lt;BR /&gt;Jim Breeding &lt;BR /&gt;&lt;BR /&gt;In Fortran source (tstcom.h): &lt;BR /&gt;&lt;PRE&gt;&lt;FONT size="+0"&gt;
                PROGRAM TSTCOM 
	IMPLICIT NONE 
 
	INTERFACE 
	  SUBROUTINE c_module 
                    !DEC$ ATTRIBUTES C :: c_module 
	  END SUBROUTINE c_module 
	END INTERFACE 
 
	REAL A,B 
	INTEGER N1,N2,I 
	CHARACTER CARRAY*8,SETCOM(0:7) 
 
	COMMON /COM1/A,B,N1,N2,SETCOM 
               call c_module 
          END 

In C Header (tstcom.h) 
#pragma pack(2) 
extern struct dum { 
	float a; 
	float b; 
	int n1; 
	int n2; 
	char setcom[8]; 
}; 
#pragma pack() 

In C source (c_module.c) 
#include &lt;STRING.H&gt; 
#include "tstcom.h" 
 
void c_module() 
{ float aa,bb; 
  int nn1,nn2; 
  char setcom2[8]; 
  extern struct dum COM1; 
 
  aa = COM1.a; 
  bb = COM1.b; 
  nn1 = COM1.n1; 
  nn2 = COM1.n2; 
  strcpy(COM1.setcom,"ijklmnop"); 
} 
&lt;/STRING.H&gt;&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Dec 2001 10:22:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Exchanging-data-between-common-block-and-C-struct/m-p/976526#M25109</guid>
      <dc:creator>jcbreeding</dc:creator>
      <dc:date>2001-12-07T10:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Exchanging data between common block and C struct</title>
      <link>https://community.intel.com/t5/Software-Archive/Exchanging-data-between-common-block-and-C-struct/m-p/976527#M25110</link>
      <description>It would be helpful to see a test case that &lt;B&gt;doesn't&lt;/B&gt; work...&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Sat, 08 Dec 2001 01:39:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Exchanging-data-between-common-block-and-C-struct/m-p/976527#M25110</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2001-12-08T01:39:35Z</dc:date>
    </item>
  </channel>
</rss>

