RE: Does g++ really need to compile main, if c++ code is involved?

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

 



> -----Original Message-----
> From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
> Behalf Of Eric Wolf
> Sent: Thursday, March 20, 2014 2:28 AM
> To: gcc-help@xxxxxxxxxxx
> Subject: Does g++ really need to compile main, if c++ code is involved?
> 
> Hello there!
> 
> We have a big bunch of C and C++ code in our product and compile main
> with g++, because I read in
> 
> http://www.parashift.com/c++-faq/overview-mixing-langs.html
> 
> that this is needed.
> 
> Can we get rid of this condition? For example by not using exceptions,
> which are not caught and not using global/static non pod variables and
> not using class wide non pod variables?

It's not exceptions only for which this is required.  C++ performs "name-mangling" on the symbols which doesn't happen in C.  I'm not sure if I have enough context here to answer decisively, however, I think this FAQ link you've provided assumes that you're wishing to compile a C++ program and link with C sources.  It is possible to do the opposite.  Interestingly, the very FAQ you linked to says as much and that you should continue reading that section for how to perform this.  In fact, this link even states, "BTW there is another way to handle this whole thing: compile all your code (even your C-style code) using a C++ compiler."

I'll bet the rest of the FAQ in section 32 will be most interesting reading for you.

Andy





[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