From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19243 invoked by alias); 22 Nov 2012 21:06:48 -0000 Received: (qmail 19234 invoked by uid 22791); 22 Nov 2012 21:06:48 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ia0-f175.google.com (HELO mail-ia0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Nov 2012 21:06:43 +0000 Received: by mail-ia0-f175.google.com with SMTP id z3so6235039iad.20 for ; Thu, 22 Nov 2012 13:06:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.12.138 with SMTP id y10mr4228974igb.58.1353618403086; Thu, 22 Nov 2012 13:06:43 -0800 (PST) Received: by 10.42.158.202 with HTTP; Thu, 22 Nov 2012 13:06:42 -0800 (PST) In-Reply-To: References: <72041471EE7D1540B7ECD771EA430DB7062251ED@AMESS102.proton.intra.irsn.fr> Date: Thu, 22 Nov 2012 21:06:00 -0000 Message-ID: Subject: Re: [C++] anonymous struct linkage From: Jonathan Wakely To: LAMOME Julien CS-SI Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00179.txt.bz2 On 22 November 2012 21:03, Jonathan Wakely wrote: > On 22 November 2012 15:44, LAMOME Julien CS-SI > wrote: >> Hi, >> we have a code mixing C++ and Fortran 77. In fortran, we have some COMMON like : >> COMMON / DEMOF/VARIABLE >> Which are include in fortran source file like this : >> #include >> >> We link with C++ code like this : >> struct { double variable}demof ; >> >> The problem is : >> Between gcc 4.3 and gcc 4.6, the linkage of demof (in C++) change from global to local. This breaks the link between C++ and fortran. >> >> How can I restore the global linkage in gcc 4.6 ? > > Give the type a name: > > struct D { double variable; } demof; > > Problem solved. Alternatively, give it C language linkage: extern "C" { struct { double d; } demof; }