This is the mail archive of the gcc-patches@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: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'


Hi Richard,

Uh, I don't think we should do that. Why do we include cstring here anyways?

Ian - you added this include in rev. 167764, I don't think that was "proper".
But I'm not sure wrapping a system.h include inside extern "C" from a C++
plugin is proper either ...

since the plugin needs to call GCC routines, and GCC is built as C, it has to wrap at least some GCC headers in "extern C" to avoid mangling of the names of those GCC routines (otherwise you can't load the plugin because the linker will look for the mangled names in GCC and not find them). But perhaps you know a trick to avoid the name mangling problem? It is true that maybe via a careful dance it is possible to not wrap system.h in "extern C" - I will give it a go.

Ciao, Duncan.


Thanks, Richard.

Thanks, Duncan.

Index: gcc/system.h
===================================================================
--- gcc/system.h        (revision 188518)
+++ gcc/system.h        (working copy)
@@ -191,7 +191,9 @@
  #endif

  #ifdef __cplusplus
+extern "C++" {
  # include<cstring>
+}
  #endif

/* Some of glibc's string inlines cause warnings. Plus we'd rather


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