From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32024 invoked by alias); 23 Aug 2008 02:31:44 -0000 Received: (qmail 32014 invoked by uid 22791); 23 Aug 2008 02:31:43 -0000 X-Spam-Check-By: sourceware.org Received: from dessent.net (HELO dessent.net) (69.60.119.225) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 23 Aug 2008 02:31:05 +0000 Received: from localhost.localdomain ([127.0.0.1] helo=dessent.net) by dessent.net with esmtp (Exim 4.50) id 1KWiu7-0006Uh-FR; Sat, 23 Aug 2008 02:31:03 +0000 Message-ID: <48AF7666.E16B03F1@dessent.net> Date: Sat, 23 Aug 2008 02:37:00 -0000 From: Brian Dessent Reply-To: gcc-help@gcc.gnu.org X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: Seyran Avanesyan CC: gcc-help@gcc.gnu.org Subject: Re: extern "C" From command line References: <200808191257.28899.zepm@gatech.edu> <48AE1E8A.12ADDE12@dessent.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2008-08/txt/msg00248.txt.bz2 Seyran Avanesyan wrote: > The functions are going to be exported from a Dll, which is going to be > done using MinGW. Is that still requires that client of that Dll be > compiled with MinGW? If they have C++ linkage then they need to be called with a C++ compiler with compatible ABI. If you want to mix compilers with different C++ ABIs (such as gcc and MSVC) then you need to use C linkage. > The problem is I need to MinGW compile a Dll as C++ not as C, and call > exported functions from MSVC compiled application. Then you need C linkage, which means you have no choice but to enclose the code in "extern C" (or compile it with a C compiler of course.) If you really can't modify the source.cpp file then I still don't see why you can't do something like: extern "C" { #include "source.cpp" } Brian