[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [cdt-dev] Mixed C/C++ in MBS
|
Actually in our case things are more complicated because we have options in our compiler to force it to treat .c files as C++. We use the same compiler regardless of file though (our nature is set to "both").
___________________________________________
Chris Recoskie
Software Designer
Texas Instruments, Toronto
http://eclipse.org/cdt
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On
> Behalf Of Doug Schaefer
> Sent: Monday, February 27, 2006 10:41 AM
> To: CDT General developers list.
> Subject: RE: [cdt-dev] Mixed C/C++ in MBS
>
> 1. Do you always want to compile source with C extensions with the C
> compiler and sources with C++ extensions with the C++ compiler?
>
> [D] Yes. g++ calls the gcc C compiler when it sees a C file anyway.
>
> 2. What about the linker to use? With mixed C/C++ is it always the C++
> linker?
>
> [D] Yes. For now the linker needs to stay as it is. Some have argued that
> we
> should not be using the nature for this but rather a build setting, but
> I'm
> not sure if that makes things better or just different...
>
> 3. Doug suggests that we make the C compiler "active" in a C++ project -
> I
> assume you mean the reference Gnu tool-chains? There is nothing stopping
> anyone from doing that in their own tool-chain.
>
> [D] Of course. The setting I am talking about is on the gnu C compiler
> definition. I am not proposing that we get rid of nature handling for
> tools.
>
> 4. What about Pete's scenario below? If the user has only C sources and
> selects a C project, but is using one or more C++ libraries, will the C
> linker work? If not, what can we do about this case?
>
> [D] The C linker should work in this case. I assume that the C++ code is
> wrapped with C code to provide an interface for it to be called by other C
> code. Actually you can use the C linker to link C++ code as long as you
> have
> the correct libraries on the link line (libstdc++ for example). For that
> matter, linking is inherently language independent, especially if you use
> ld
> as the linker, which is what gcc and g++ call anyway.
>
> [D] To summarize, my proposal is to change the nature of the gnu C
> compiler
> to be both and to change the order of the tools listed in the gnu configs
> to
> list the C++ compiler first. That's all.
>
> Thanks,
> Doug
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev