aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2/headergenerator.cpp
diff options
context:
space:
mode:
authorTilman Roeder <tilman.roder@qt.io>2018-07-23 14:19:25 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-22 06:58:20 +0000
commitb550b4feb7b6009c1a9d18a604a16844bb9afbc0 (patch)
treeabf7965c4dd997298559cfb98cfe43b0d0075a8d /sources/shiboken2/generator/shiboken2/headergenerator.cpp
parent275da7f3749d99426ad107398f6f71e9c8db16c3 (diff)
Expose Shiboken generated Python module object
This change exposes the module object (a PyObject*) to the global namespace as Sbk[TYPESYSTEM NAME]ModuleObject. This is useful when generating bindings for cases where Python will run embedded into a host application. This variable is also included in the headers, where it is declared as `extern PyObject* Sbk[TYPESYSTEM NAME]ModuleObject;` for the convenience of developers reading the generated sources. Change-Id: Iaaa38b66b5d3aabc0fb8f995f964cd7aef2a11da Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/headergenerator.cpp')
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index 755db10e3..a0fbfecf6 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -381,6 +381,8 @@ bool HeaderGenerator::finishGeneration()
macrosStream << "// This variable stores all Python types exported by this module." << endl;
macrosStream << "extern PyTypeObject** " << cppApiVariableName() << ';' << endl << endl;
+ macrosStream << "// This variable stores the Python module object exported by this module." << endl;
+ macrosStream << "extern PyObject* " << pythonModuleObjectName() << ';' << endl << endl;
macrosStream << "// This variable stores all type converters exported by this module." << endl;
macrosStream << "extern SbkConverter** " << convertersVariableName() << ';' << endl << endl;