Using C++ within a backend?
Matthieu Moy
Matthieu.Moy@imag.fr
Tue Apr 15 20:44:00 GMT 2003
Alexandre Courbot <Alexandre.Courbot@lifl.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
More information about the Gcc
mailing list