swig/Lib/c
Vadim Zeitlin 727a65c0e8 Fix using exception in modules importing other modules
Ensure that we have only a single SWIG_CException_Raise() function
across all modules instead of having per-module functions and, worse,
per-module PendingException variables, which resulted in compile-time
errors and couldn't work anyhow because function checking for the
current exception didn't necessarily use the same "global" variable
where it was stored. More formally, old version resulted in ODR
violations and undefined behaviour.

The way we avoid it now is rather ugly and consists in excluding
SWIG_CException from wrapping using the hack in the source code which
postpones wrapping this class until the very end and checks if we had
encountered any %import directives and simply doesn't wrap it if we did.

The same code is used to define the special SWIG_CException_DEFINED
preprocessor symbol which is then used in the generated code to prevent
the SWIG_CException class declaration from being compiled as part of the
wrapper too (because this still happens due to %inline being used for
its definition, and there doesn't seem to be any better way to avoid
this).

This is definitely not pretty, but at least adding "throw(char*)" to a
couple of functions in mod_[ab].i test suite files works now instead of
failing (even without linking and running) as before. This commit
doesn't modify the test suite to avoid possible problems with the other
languages, however.
2021-11-27 00:19:05 +01:00
..
boost_shared_ptr.i Add minimal shared_ptr support 2021-10-15 01:26:22 +02:00
c.swg Fix typemaps for arrays of objects and object pointers 2021-11-10 00:53:39 +01:00
cexcept.swg Fix using exception in modules importing other modules 2021-11-27 00:19:05 +01:00
cheader.swg Make SWIGIMPORT definition more consistent with SWIGEXPORT 2021-10-20 01:57:18 +02:00
clabels.swg Remove unused SWIGPROTECT 2016-04-13 18:10:35 +02:00
std_common.i Revert "Use std/std_vector.i instead of a poor copy in c/std_vector.i" 2021-10-07 22:03:47 +02:00
std_except.i Many major improvements. Almost all testsuite compiles now. 2009-04-15 23:30:16 +00:00
std_map.i Fix std::map<> typemap 2021-10-07 22:03:47 +02:00
std_pair.i Add trivial but working std::pair typemaps implementation 2019-08-07 02:16:33 +02:00
std_set.i Add simple std::set<> typemaps too 2021-10-07 22:03:47 +02:00
std_shared_ptr.i Add minimal shared_ptr support 2021-10-15 01:26:22 +02:00
std_string.i Streamline and fix returning objects by value 2019-08-06 02:35:25 +02:00
std_vector.i Allow using vector with classes without default ctor in C too 2021-10-07 22:03:47 +02:00
stl.i Many major improvements. Almost all testsuite compiles now. 2009-04-15 23:30:16 +00:00
typemaps.i Many major improvements. Almost all testsuite compiles now. 2009-04-15 23:30:16 +00:00