On Fri, Jun 15, 2012 at 4:59 AM, Duncan Sands <baldr...@free.fr> wrote: > 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.
Including the whole gcc/system.h in an extern "C" is not good. But you can put the declarations in gcc/system.h that you want to have C language spec in such block.