From 07e3d62ae85e20572d0260a71db43e3dbd49647a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 15 Jun 2010 17:58:42 +0000 Subject: [PATCH] Use a single extern "C" around all the wrappers, not one per wrapper. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12126 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/go.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/Modules/go.cxx b/Source/Modules/go.cxx index 45f6ef1da..e958a0a7f 100644 --- a/Source/Modules/go.cxx +++ b/Source/Modules/go.cxx @@ -385,6 +385,10 @@ private: Printf(f_go_begin, "\npackage %s\n\n", package); + // All the C++ wrappers should be extern "C". + + Printv(f_c_wrappers, "#ifdef __cplusplus\n", "extern \"C\" {\n", "#endif\n\n", NULL); + // Set up the hash table for types not defined by SWIG. undefined_types = NewHash(); @@ -433,6 +437,9 @@ private: f_c_directors = NULL; } + // End the extern "C". + Printv(f_c_wrappers, "#ifdef __cplusplus\n", "}\n", "#endif\n\n", NULL); + Dump(f_c_runtime, f_c_begin); Dump(f_c_wrappers, f_c_begin); Dump(f_c_init, f_c_begin); @@ -1149,8 +1156,6 @@ private: // Start the function definition. - Printv(f->def, "#ifdef __cplusplus\n", "extern \"C\"\n", "#endif\n", NULL); - Printv(f->def, "void\n", wname, "(void *swig_v)\n", "{\n", NULL); // The single function parameter is a pointer to the real argument @@ -1269,8 +1274,6 @@ private: // Start the function definition. - Printv(f->def, "#ifdef __cplusplus\n", "extern \"C\"\n", "#endif\n", NULL); - String *fnname = NewString(""); Printv(fnname, go_prefix, "_", wname, "(", NULL);