[Pyrex] Private C fields for public extension types?

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Sat Jul 1 15:24:30 UTC 2006


Hi,

I'm currently facing a problem with extension types, where I would like to
provide some types from a large Pyrex module (lxml.etree) as part of a public
C interface. This is normally done through the "cdef public class" idiom,
which creates a public header file.

The problem is that this copies the complete C declaration of the type into
the header file, including all declared fields, but not recursively including
the declaration of the types of these fields. So, if I want to make a type
public, I'm required to make all super types and referenced types public as
well. Otherwise, the C compiler will complain about undefined types.

Now, while the super types are easily made public, the types contain pointers
to several other extension types and I cannot declare all of them public. This
would break the modularisation idea and let the public API explode.

So I would like to have a way to, say, replace some of the extension type
pointers (__pyx_obj_...) by void pointers to avoid having to make them
publicly available. Or is there any other way to make the header file
compilable without adding all type dependencies?

Thanks for any help,
Stefan



More information about the Pyrex mailing list