Support for the exception specifications using types was removed in C++17 (and "throw ()" in C++20), so don't use them when using the C++ compiler any longer, as this broke the example with recent g++ versions that use C++17 by default. We still need them for SWIG, however, so use SWIG_THROW macro, defined differently for SWIG and the compiler, to preserve the existing behaviour. Using %except might be a better idea, but would require more changes.
17 lines
357 B
OpenEdge ABL
17 lines
357 B
OpenEdge ABL
/* File : example.i */
|
|
%module example
|
|
|
|
%{
|
|
#include "example.h"
|
|
%}
|
|
|
|
%typemap(throws, noblock="1") Exc {
|
|
SWIG_exception(SWIG_RuntimeError, $1.msg);
|
|
}
|
|
|
|
/* This needs to be defined for SWIG, even though it can't be used in C++ any more. */
|
|
#define SWIG_THROW(...) throw(__VA_ARGS__)
|
|
|
|
/* Let's just grab the original header file here */
|
|
%include "example.h"
|
|
|