This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using C++ within a backend?
- From: Matthieu Moy <Matthieu dot Moy at imag dot fr>
- To: Alexandre Courbot <Alexandre dot Courbot at lifl dot fr>
- Cc: GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Tue, 15 Apr 2003 21:01:23 +0200
- Subject: Re: Using C++ within a backend?
- Organization: Verimag, STMicroelectronics
- References: <200304151219.02688.Alexandre.Courbot@lifl.fr>
Alexandre Courbot <Alexandre dot Courbot at lifl dot fr> writes:
> Hi all,
Hi,
> Since I need to use the type-checking system designed for the
> architecture I'm porting gcc to, I'll need to use C++ code from my
> backend (the library I have to link to is written in C++). I thought
> this might be a good idea to write as much of the backend as
> possible in C++, and define the needed functions as extern "C".
I have the same problem with the file tree.h, which I can't include
from a C++ program, even with
extern "C" {
#include "..."
}
For now, I'm writting most of my code in pure C, and I have wrappers
around C++ functions written in C. When I want to use a tree from a
C++ file, I just typedef it to be a void *.
But in the long run, I think that GCC's header files should compile in
C++ : That would be simpler for code reuse and linking to C++
libraries, and anyway, most of the time, when a C program doesn't
compile in C++, this is because it's too dirty ...
--
Matthieu