swig/Lib/python/pyruntime.swg
William S Fulton c7363fd95e Workaround for Python gcc MingGW WIN32 hypot declaration error
Fixes:
In file included from C:/msys64/mingw32/include/c++/7.3.0/math.h:36:0,
                 from C:/Python27/include/pyport.h:325,
                 from C:/Python27/include/Python.h:61,
                 from example_wrap.cxx:174:
C:/msys64/mingw32/include/c++/7.3.0/cmath:1136:11: error: '::hypot' has not been declared
   using ::hypot;
           ^~~~~

See https://stackoverflow.com/questions/28683358/error-hypot-has-not-been-declared-in-cmath-while-trying-to-embed-python/28683412 and https://bugs.python.org/issue11566
2018-11-20 19:47:42 +00:00

27 lines
1,004 B
Text

%insert(runtime) %{
#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
# include <math.h>
#endif
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* Use debug wrappers with the Python release dll */
# undef _DEBUG
# include <Python.h>
# define _DEBUG 1
#else
# include <Python.h>
#endif
%}
%insert(runtime) "swigrun.swg"; /* SWIG API */
%insert(runtime) "swigerrors.swg"; /* SWIG errors */
%insert(runtime) "pyhead.swg"; /* Python includes and fixes */
%insert(runtime) "pyerrors.swg"; /* Python errors */
%insert(runtime) "pythreads.swg"; /* Python thread code */
%insert(runtime) "pyapi.swg"; /* Python API */
%insert(runtime) "pyrun.swg"; /* Python run-time code */
#if defined(SWIGPYTHON_BUILTIN)
%insert(runtime) "builtin.swg"; /* Specialization for classes with single inheritance */
#endif