This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using C++ within a backend?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]