aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-06 08:37:26 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-07 08:50:31 +0000
commite801fdab20ad4f5f47deaf49600af0d5f02ecc51 (patch)
tree45109d857818fca04e31701840b67f915708e34c /sources/shiboken2/generator/shiboken2/cppgenerator.cpp
parent4ee18ba27bb63f8dd3d7772b67f21c7aa7817e5c (diff)
shiboken2: Simplify the export of the generated module init function
Remove the version-dependent #ifdef. Change-Id: I15907500ab95d9e48d90a57893197c9b4f18a037 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/cppgenerator.cpp')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index ab8f5a6fc..18137a985 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -5964,9 +5964,10 @@ bool CppGenerator::finishGeneration()
// PYSIDE-510: Create a signatures string for the introspection feature.
writeSignatureStrings(s, signatureStream, moduleName(), "global functions");
- s << "SBK_MODULE_INIT_FUNCTION_BEGIN(" << moduleName() << ")\n";
+ s << "extern \"C\" LIBSHIBOKEN_EXPORT PyObject *PyInit_"
+ << moduleName() << "()\n{\n";
- ErrorCode errorCode(QLatin1String("SBK_MODULE_INIT_ERROR"));
+ ErrorCode errorCode(QLatin1String("nullptr"));
// module inject-code target/beginning
if (!snips.isEmpty())
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::TargetLangCode);
@@ -5975,7 +5976,7 @@ bool CppGenerator::finishGeneration()
s << INDENT << "{\n" << indent(INDENT)
<< INDENT << "Shiboken::AutoDecRef requiredModule(Shiboken::Module::import(\"" << requiredModule << "\"));\n"
<< INDENT << "if (requiredModule.isNull())\n" << indent(INDENT)
- << INDENT << "return SBK_MODULE_INIT_ERROR;\n" << outdent(INDENT)
+ << INDENT << "return nullptr;\n" << outdent(INDENT)
<< INDENT << cppApiVariableName(requiredModule)
<< " = Shiboken::Module::getTypes(requiredModule);\n"
<< INDENT << convertersVariableName(requiredModule)
@@ -6078,10 +6079,8 @@ bool CppGenerator::finishGeneration()
// finish the rest of __signature__ initialization.
s << INDENT << "FinishSignatureInitialization(module, " << moduleName()
- << "_SignatureStrings);\n";
-
- s << Qt::endl;
- s << "SBK_MODULE_INIT_FUNCTION_END\n";
+ << "_SignatureStrings);\n"
+ << INDENT << "\nreturn module;\n}\n";
return file.done() != FileOut::Failure;
}