Hi,

Lisandro Dalcin wrote:
> Currently, if one has something like this:
> 
> # mymod.pyx
> cdef public api class Foo [type PyFoo_Type, object PyFooObject]:
>     cdef int bar
> 
> The generated C header file contains this:
> 
> # mymod.h
> struct PyFooObject {
>   PyObject_HEAD
>   int bar;
> };
> 
> 
> Could the generated code be changed to say like this ??:
> 
> typedef struct PyFooObject {
>   PyObject_HEAD
>   int bar;
> } PyFooObject;

This patch works for me. It changes the declaration also in the .c files,
though. Any objections?

Stefan

diff -r 9527edc22cb6 Cython/Compiler/ModuleNode.py
--- a/Cython/Compiler/ModuleNode.py	Fri Jun 13 20:50:39 2008 +0200
+++ b/Cython/Compiler/ModuleNode.py	Wed Jun 18 19:07:38 2008 +0200
@@ -676,7 +676,7 @@ class ModuleNode(Nodes.Node, Nodes.Block
         if not type.scope:
             return # Forward declared but never defined
         header, footer = \
-            self.sue_header_footer(type, "struct", type.objstruct_cname)
+            self.sue_header_footer(type, "typedef struct", type.objstruct_cname)
         code.putln("")
         code.putln(header)
         base_type = type.base_type
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to