add John Lenz patch for avoiding the runtime library, but allowing the old approach to coexist
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6288 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6c80ef2f7b
commit
afed1d4126
4 changed files with 66 additions and 8 deletions
|
|
@ -22,10 +22,13 @@ SWIGEXPORT(void) SWIG_init(void) {
|
|||
d = PyModule_GetDict(m);
|
||||
|
||||
if (!typeinit) {
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
||||
}
|
||||
typeinit = 1;
|
||||
#ifdef SWIG_DISABLE_RUNTIME
|
||||
SWIG_Python_LookupTypePointer(&swig_type_list_handle);
|
||||
#endif
|
||||
for (i = 0; swig_types_initial[i]; i++) {
|
||||
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
||||
}
|
||||
typeinit = 1;
|
||||
}
|
||||
SWIG_InstallConstants(d,swig_const_table);
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,23 @@
|
|||
#define SWIG_NEWOBJ SWIG_OLDOBJ + 1
|
||||
#define SWIG_PYSTR SWIG_NEWOBJ + 1
|
||||
|
||||
/*
|
||||
swig internal C/C++ API
|
||||
*/
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SWIG API.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Common SWIG API */
|
||||
#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Python_ConvertPtr(obj, pp, type, flags)
|
||||
#define SWIG_NewPointerObj(p, type, flags) SWIG_Python_NewPointerObj(p, type, flags)
|
||||
#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
|
||||
|
||||
/* Python-specific SWIG API */
|
||||
#define SWIG_newvarlink() SWIG_Python_newvarlink()
|
||||
#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
|
||||
#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags)
|
||||
#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
|
||||
#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
|
||||
|
||||
/* Internal C/C++ API */
|
||||
#ifdef __cplusplus
|
||||
#define SWIG_new_array(size,Type) (new Type[(size)])
|
||||
#define SWIG_delete(cptr) delete cptr
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ typedef struct swig_const_info {
|
|||
#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
|
||||
#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
|
||||
|
||||
|
||||
#ifdef SWIG_NOINCLUDE
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -601,6 +600,30 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SWIG_DISABLE_RUNTIME
|
||||
/* lookup type pointer */
|
||||
SWIGRUNTIME(void)
|
||||
SWIG_Python_LookupTypePointer(swig_type_info ***type_list_handle) {
|
||||
PyObject *module, *pointer;
|
||||
void *type_pointer;
|
||||
|
||||
/* first check if module already created */
|
||||
type_pointer = PyCObject_Import("swig_runtime_data", "type_pointer");
|
||||
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);
|
||||
pointer = PyCObject_FromVoidPtr((void *) (*type_list_handle), NULL);
|
||||
if (pointer && module) {
|
||||
PyModule_AddObject(module, "type_pointer", pointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* SWIG_DISABLE_RUNTIME */
|
||||
|
||||
|
||||
#endif /* SWIG_NOINCLUDE */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,5 +5,23 @@
|
|||
%}
|
||||
|
||||
%insert(runtime) "precommon.swg";
|
||||
%insert(runtime) %{
|
||||
|
||||
#ifndef SWIG_ALLOW_RUNTIME
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Disable runtime library use, everything is used as static
|
||||
* ----------------------------------------------------------------------------- */
|
||||
#ifndef SWIG_DISABLE_RUNTIME
|
||||
#define SWIG_DISABLE_RUNTIME
|
||||
#endif
|
||||
#ifdef SWIG_GLOBAL
|
||||
#undef SWIG_GLOBAL
|
||||
#endif
|
||||
#ifdef SWIG_NOINCLUDE
|
||||
#undef SWIG_NOINCLUDE
|
||||
#endif
|
||||
#endif /* SWIG_ALLOW_RUNTIME */
|
||||
|
||||
%}
|
||||
%insert(runtime) "common.swg"; /* Common type-checking code */
|
||||
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue