add -nortti option in python, to avoid using RTTI, mainly with directors

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6999 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-02-25 00:47:10 +00:00
commit 02a61719bd
3 changed files with 41 additions and 9 deletions

View file

@ -13,15 +13,33 @@
#include <string>
extern "C" {
struct swig_type_info;
}
/*
Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the
'Swig' namespace. This could be usefull for multi-modules projects.
*/
#ifdef SWIG_DIRECTOR_STATIC
/* Force anonymous (static) namespace */
#define Swig
#endif
/*
Use -DSWIG_DIRECTOR_NORTTI if you prefer to avoid the use of RTTI
and dynamic_cast<>. But be aware that directors could stop working
when using this option.
*/
#if defined(SWIG_DIRECTOR_NORTTI)
# define SWIG_DIRECTOR_CAST(arg) (Swig::Director*)(arg)
#else
# define SWIG_DIRECTOR_CAST(arg) dynamic_cast<Swig::Director*>(arg)
#endif
extern "C" {
struct swig_type_info;
}
namespace Swig {
/* base class for director exceptions */
class DirectorException {

View file

@ -122,3 +122,12 @@ These methods "may be called" if needed.
#endif
#define %nocallback %nopythoncallback; %feature("callback","")
/* When using -nortti, tell directors to avoid RTTI */
#ifdef SWIG_NORTTI
%insert("runtime") %{
#ifndef SWIG_DIRECTOR_NORTTI
#define SWIG_DIRECTOR_NORTTI
#endif
%}
#endif