aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-12-09 19:37:52 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:18:26 -0300
commit1291121270dea7f3fe807e21fe93db291d4f8d0a (patch)
treefaefe7818b774092fc6364d85740cf9be1a1f2ce /generator
parentcd110ab3f4f912e2f9e400909f2d3d90abbb9d60 (diff)
Fix Windows build of shiboken module.
Diffstat (limited to 'generator')
-rw-r--r--generator/cppgenerator.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 97da37d4a..7142abc75 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -3946,8 +3946,11 @@ void CppGenerator::finishGeneration()
}
s << INDENT << "// Create an array of wrapper types for the current module." << endl;
- s << INDENT << "static PyTypeObject* cppApi[" << "SBK_" << moduleName() << "_IDX_COUNT" << "];" << endl;
- s << INDENT << cppApiVariableName() << " = cppApi;" << endl << endl;
+ int maxTypeIndex = getMaxTypeIndex();
+ if (maxTypeIndex) {
+ s << INDENT << "static PyTypeObject* cppApi[SBK_" << moduleName() << "_IDX_COUNT];" << endl;
+ s << INDENT << cppApiVariableName() << " = cppApi;" << endl << endl;
+ }
s << "#ifdef IS_PY3K" << endl;
s << INDENT << "PyObject* module = Shiboken::Module::create(\"" << moduleName() << "\", &moduledef);" << endl;
@@ -3998,7 +4001,8 @@ void CppGenerator::finishGeneration()
foreach (QByteArray type, typeResolvers)
s << INDENT << typeResolverString(type) << ';' << endl;
- s << endl << INDENT << "Shiboken::Module::registerTypes(module, " << cppApiVariableName() << ");" << endl;
+ if (maxTypeIndex)
+ s << endl << INDENT << "Shiboken::Module::registerTypes(module, " << cppApiVariableName() << ");" << endl;
s << endl << INDENT << "if (PyErr_Occurred()) {" << endl;
{