Re: c and C++ together

From: George Greer (greerga@circlemud.org)
Date: 11/30/00


On Thu, 30 Nov 2000, Mike Redick wrote:

>Ok, I know it can be done... hell I've even done it before!  Just not with
>this compiler.  So how can I get c and C++ files to compile together using
>MSVC++ ver. 6.0?

Compile everything as C++ or C. C++ does name-mangling, C does not.
Therefore, if you compile everything as one or the other, you're set.  You
could also throw:

#ifdef __cplusplus
extern "C" {
#endif

int bar(int x);
void foo(void);

#ifdef __cplusplus
}
#endif

Into your headers to tell the C++ compiler what should be called via
C-style functions.  That's only recomended if you can't compile the C stuff
as C++ for whatever reason (external library for instance).

--
George Greer            | If it's about the CircleMUD mailing list,
greerga@circlemud.org   | mail owner-circle@post.queensu.ca instead.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT