- Add SWIG_RUNTIME_VERSION to new type sharing code. This is for future-proof, if
the format of swig_type_info ever changes, this number should be incremented - Add SWIG_LINK_RUNTIME and SWIG_STATIC_RUNTIME symbols to python - Convert inline into SWIGINLINE git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6475 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
cb3ef63778
commit
b83fe6bd77
14 changed files with 140 additions and 41 deletions
|
|
@ -4,6 +4,25 @@
|
|||
|
||||
%init %{
|
||||
|
||||
#ifdef SWIG_LINK_RUNTIME
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(_MSC_VER) || defined(__GNUC__)
|
||||
# define SWIGIMPORT(a) extern a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGIMPORT(a) a _export
|
||||
# else
|
||||
# define SWIGIMPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGIMPORT(a) a
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT(void *) SWIG_ReturnGlobalTypeList(void *);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
|
@ -22,7 +41,14 @@ SWIGEXPORT(void) SWIG_init(void) {
|
|||
d = PyModule_GetDict(m);
|
||||
|
||||
if (!typeinit) {
|
||||
#ifdef SWIG_LINK_RUNTIME
|
||||
swig_type_list_handle = (swig_type_info **) SWIG_ReturnGlobalTypeList(swig_type_list_handle);
|
||||
#else
|
||||
# ifndef SWIG_STATIC_RUNTIME
|
||||
SWIG_Python_LookupTypePointer(&swig_type_list_handle);
|
||||
# endif
|
||||
#endif
|
||||
printf("%08x\n", swig_type_list_handle);
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
static SWIGINLINE void
|
||||
SWIG_Python_NullRef(const char *type)
|
||||
{
|
||||
if (type) {
|
||||
|
|
@ -346,7 +346,7 @@ type_error:
|
|||
}
|
||||
|
||||
/* Convert a pointer value, signal an exception on a type mismatch */
|
||||
static inline void *
|
||||
static void *
|
||||
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
|
||||
void *result;
|
||||
if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
|
||||
|
|
@ -539,16 +539,16 @@ SWIG_Python_LookupTypePointer(swig_type_info ***type_list_handle) {
|
|||
void *type_pointer;
|
||||
|
||||
/* first check if module already created */
|
||||
type_pointer = PyCObject_Import("swig_runtime_data", "type_pointer");
|
||||
type_pointer = PyCObject_Import("swig_runtime_data" SWIG_RUNTIME_VERSION, "type_pointer" SWIG_TYPE_TABLE_NAME);
|
||||
if (type_pointer) {
|
||||
*type_list_handle = (swig_type_info **) type_pointer;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
/* create a new module and variable */
|
||||
module = Py_InitModule("swig_runtime_data", NULL);
|
||||
module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, NULL);
|
||||
pointer = PyCObject_FromVoidPtr((void *) (*type_list_handle), NULL);
|
||||
if (pointer && module) {
|
||||
PyModule_AddObject(module, "type_pointer", pointer);
|
||||
PyModule_AddObject(module, "type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue