Use a unique prefix for SWIG_CException_Raise()
This allows using different modules generated by SWIG in the same process without conflicts.
This commit is contained in:
parent
9dd1301ec4
commit
c7fa9126ce
1 changed files with 8 additions and 0 deletions
|
|
@ -1390,6 +1390,14 @@ public:
|
||||||
|
|
||||||
// Deal with exceptions support.
|
// Deal with exceptions support.
|
||||||
if (exceptions_support_ == exceptions_support_enabled) {
|
if (exceptions_support_ == exceptions_support_enabled) {
|
||||||
|
// Redefine SWIG_CException_Raise() to have a unique prefix in the shared library built from SWIG-generated sources to allow using more than one extension
|
||||||
|
// in the same process without conflicts. This has to be done in this hackish way because we really need to change the name of the function itself, not
|
||||||
|
// its wrapper (which is not even generated).
|
||||||
|
Printv(f_runtime,
|
||||||
|
"#define SWIG_CException_Raise ", (ns_prefix ? ns_prefix : module_name), "_SWIG_CException_Raise\n",
|
||||||
|
NIL
|
||||||
|
);
|
||||||
|
|
||||||
// We need to check if we have any %imported modules, as they would already define the exception support code and we want to have exactly one copy of it
|
// We need to check if we have any %imported modules, as they would already define the exception support code and we want to have exactly one copy of it
|
||||||
// in the generated shared library, so check for "import" nodes.
|
// in the generated shared library, so check for "import" nodes.
|
||||||
if (find_first_named_import(n)) {
|
if (find_first_named_import(n)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue