Robert Dewar <de...@adacore.com> writes: > Ian Lance Taylor wrote: > >> I think the function to change is Gen_Output_File_C in bindgen.adb. > > I don't really see any urgency for this change, yes gnatbind has > the option to generate C, but it is not the normal path, and only > of use in unusual circumstances, so I don't really see the need > for this output to be C++ compatible. The documentation doesn't > claim this after all.
gnatbind -C appears to be used when bootstrapping gcc to generate .c files. With --enable-build-with-cxx, those .c files will be compiled with a C++ compiler. The symbols emitted by that compilation need to be linkable with the symbols emitted when compiling Ada code, so the .c files need extern "C" to avoid C++ mangling. Or at least so it seems to me. I may be missing some key step. Ian