delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/28/19:46:04

From: "DeHackEd" <notgiven AT out DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <36afa8fd DOT 22506476 AT news DOT polito DOT it>
Subject: Re: C functions in C++
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.0810.800
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.0810.800
Message-ID: <bt7s2.616$hd7.160@tundra.ops.attcanada.net>
Date: Thu, 28 Jan 1999 19:40:09 -0500
NNTP-Posting-Host: 142.194.222.96
X-Trace: tundra.ops.attcanada.net 917570503 142.194.222.96 (Fri, 29 Jan 1999 00:41:43 GMT)
NNTP-Posting-Date: Fri, 29 Jan 1999 00:41:43 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Declare the functions of C using extern "C" as follows:

extern "C"
{
   // all prototypes here
};

You may have to declare C++ functions as extern C as well if you have such
problems the other way around. Though I doubt this affects most C++ additions,
you cannot use function overloads, as extern "C" essentially removes this
feature in exchange for C support.
Also beware that the C compiler probably won't like "extern "C"", which is why
it's always #ifdef'd in header files.

--
"DeHackEd"

My Email address in the header is fake (spammers). Email me at this address:

http://www.geocities.com/cgi-bin/homestead/mail.pl?dehacked




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019