aboutsummaryrefslogtreecommitdiffstats
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
parentcd110ab3f4f912e2f9e400909f2d3d90abbb9d60 (diff)
Fix Windows build of shiboken module.
-rw-r--r--generator/cppgenerator.cpp10
-rw-r--r--tests/samplebinding/typesystem_sample.xml2
2 files changed, 9 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;
{
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 9a0ea9920..bced56f8d 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -18,6 +18,8 @@
<primitive-type name="unsigned long"/>
<primitive-type name="std::string"/>
+ <primitive-type name="std::size_t" target-lang-api-name="PyLong">
+ </primitive-type>
<primitive-type name="Complex" target-lang-api-name="PyComplex">
<conversion-rule file="complex_conversions.h"/>
<include file-name="complex.h" location="global"/>