diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index eb61752b8..343b8007f 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -77,6 +77,7 @@ static Hash *classhash; extern int GenerateDefault; extern int ForceExtern; extern int AddExtern; +extern int UseWrapperSuffix; /* import modes */ @@ -1324,7 +1325,7 @@ int Language::staticmemberfunctionHandler(Node *n) { // See Swig_MethodToFunction() for the explanation of this code. if (Getattr(n, "sym:overloaded")) { Append(cname, Getattr(defaultargs ? defaultargs : n, "sym:overname")); - } else { + } else if (UseWrapperSuffix) { Append(cname, "__SWIG"); } diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index 9344a7299..aaf3948ea 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -37,6 +37,7 @@ int Verbose = 0; int AddExtern = 0; int NoExcept = 0; int SwigRuntime = 0; // 0 = no option, 1 = -runtime, 2 = -noruntime +int UseWrapperSuffix = 0; // If 1, append suffix to non-overloaded functions too. /* Suppress warning messages for private inheritance, preprocessor evaluation etc... WARN_PP_EVALUATION 202 diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c index 36e69332c..3b20f4e4f 100644 --- a/Source/Swig/cwrap.c +++ b/Source/Swig/cwrap.c @@ -15,6 +15,8 @@ #include "swig.h" #include "cparse.h" +extern int UseWrapperSuffix; // from main.cxx + static const char *cresult_variable_name = "result"; static Parm *nonvoid_parms(Parm *p) { @@ -1083,13 +1085,13 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas in C. But when not using the suffix used for overloaded functions, we still need to ensure that the - wrapper name doesn't conflict with any wrapper functions, so make it sufficiently unique by - appending a suffix similar to the one used for overloaded functions to it. + wrapper name doesn't conflict with any wrapper functions for some languages, so optionally make + it sufficiently unique by appending a suffix similar to the one used for overloaded functions to it. */ if (code) { if (Getattr(n, "sym:overloaded")) { Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname")); - } else { + } else if (UseWrapperSuffix) { Append(mangled, "__SWIG"); } }