collect2.c (write_c_file): Wrap the ctor/dtor lists and fns with `extern "C" { ...
authorBrendan Kehoe <brendan@gcc.gnu.org>
Wed, 11 Dec 1996 23:58:22 +0000 (18:58 -0500)
committerBrendan Kehoe <brendan@gcc.gnu.org>
Wed, 11 Dec 1996 23:58:22 +0000 (18:58 -0500)
* collect2.c (write_c_file): Wrap the ctor/dtor lists and fns with
`extern "C" { ... }', to avoid having the fn names mangled with
the C++ driver.

From-SVN: r13288

gcc/collect2.c

index 452ac9943ef4624b3e83fdd657abd28409a18d72..341c70ea045f0027a1d2371e83efd9c72f73b790 100644 (file)
@@ -1789,12 +1789,14 @@ write_c_file (stream, name)
      FILE *stream;
      char *name;
 {
+  fprintf (stream, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
 #ifndef LD_INIT_SWITCH
   if (! shared_obj)
     write_c_file_glob (stream, name);
   else
 #endif
     write_c_file_stat (stream, name);
+  fprintf (stream, "#ifdef __cplusplus\n}\n#endif\n");
 }
 
 static void