[Pyrex] public extension type to replace a complex structure variable

Daehyok Shin sdhyok at gmail.com
Fri Feb 18 03:41:58 CET 2005


> You'll notice that I've used a Python list to hold the
> small objects, rather than a C array. That's because
> a C array or structure in Pyrex can't hold Python
> object references, and the SmallObject instances
> are Python objects.

The example I sent is just a extremely simplified one.
The actual structure has a pointer to very deep hiearchical structures,
and a lot of legacy C programs assumed the pointer-linked structures.
In the case, is there no way to keep the C pointer in BigObject?
Nobody here wants to change the legacy C code.

> By the way, you don't need to declare the extension
> type itself as 'public', it will be visible to Python
> code anyway. 

Thanks. I followed the instructions of PyRex.
What I understand is I cannot generate C header file without the public.
Is it right? I want to use the C header for other legacy C programs.

> Also you don't need the stuff in square
> brackets; that's almost obsolete now except for some
> very rare use cases.
The square brackets are used to generate the C structures with the
same name as legacy structures, again not to touch other legacy
functions to handle the structure.

What you suggest needs massive editing on our legacy programs,
which is the last thing I want to do.
A better way not to touch legacy programs,  still providing transparent access?

Thanks for your answer.

> Greg Ewing, Computer Science Dept, +--------------------------------------+
> University of Canterbury,          | A citizen of NewZealandCorp, a       |
> Christchurch, New Zealand          | wholly-owned subsidiary of USA Inc.  |
> greg.ewing at canterbury.ac.nz        +--------------------------------------+

-- 
Daehyok Shin (Peter)



More information about the Pyrex mailing list