Re: FW: Mixing C/C++ code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Wong wrote:

> Also, I'm a bit unclear on how the: extern "C" / extern "C++" notation
> works. If I am using g++ to compile both my C and C++ code...when and which
> of these should I use? Also, I read somewhere that I shouldn't use these
> externs if I'm on a solaris machine, is that right?

extern "C" defines a function with C linkage, so it is visible across
languages.  It's the standard way to do that.  If you are using gcc/g++
on Solaris, as far as I know it should work the same as on any other OS.
It's conceivable that Solaris linker knows things which would permit
inter-language linking without extern "C."  Unless you find an expert on
inter-Solaris compatibility (given there are several incompatible
Solaris architectures), if this is not a crucial subject of your
project, you should avoid it.
C++ linkage supports over-loaded functions, C linkage doesn't.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux