aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken/basewrapper.cpp
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-02-12 18:18:50 -0200
committerHugo Lima <hugo.lima@openbossa.org>2010-02-12 18:35:24 -0200
commit21151a2f4dc03ef6d62efcfb4a0f1f9d3dcb5183 (patch)
tree07c45ee29ccf4a2bfb216c00611f2369887c00ca /libshiboken/basewrapper.cpp
parentfa5740279daa22be3c424c8fab4468447b3cbcaf (diff)
Do not export Sbk*Type variables.
To access Sbk*Type variables from other modules, you need to use the array provided via CObjects. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'libshiboken/basewrapper.cpp')
-rw-r--r--libshiboken/basewrapper.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 2dda3a4bc..dc86fa831 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -196,6 +196,22 @@ void SbkBaseWrapper_clearReferences(SbkBaseWrapper* self)
delete self->referredObjects;
}
+bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr)
+{
+ Shiboken::AutoDecRef module(PyImport_ImportModule(moduleName));
+ if (module.isNull())
+ return false;
+
+ Shiboken::AutoDecRef cppApi(PyObject_GetAttrString(module, "_Cpp_Api"));
+ if (cppApi.isNull())
+ return false;
+
+ if (PyCObject_Check(cppApi))
+ *cppApiPtr = reinterpret_cast<PyTypeObject**>(PyCObject_AsVoidPtr(cppApi));
+
+ return true;
+}
+
// Wrapper metatype and base type ----------------------------------------------------------
extern "C"