From: Robert Bradshaw Date: Wed, 8 Oct 2008 09:09:36 +0000 (-0700) Subject: struct -> object for extern structs X-Git-Tag: 0.9.9.2.beta~54 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6049280bd4a071359eeea3c7abfd6cf7d19c023a;p=cython.git struct -> object for extern structs --- diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index e22a7441..b6519df5 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -966,7 +966,13 @@ class CStructOrUnionType(CType): code.putln("Py_DECREF(res);") code.putln("return NULL;") code.putln("}") - self._convert_code = self.declaration_code('') + ';\n' + header+";", code.buffer.getvalue() + proto = header + ";" + # This is a bit of a hack, we need a forward declaration + # due to the way things are ordered in the module... + entry = env.lookup(self.name) + if entry.visibility != 'extern': + proto = self.declaration_code('') + ';\n' + proto + self._convert_code = proto, code.buffer.getvalue() env.use_utility_code(self._convert_code) return True