[Pyrex] Initialisation of cdef global arrays with constants
[resend]
sjmachin at lexicon.net
sjmachin at lexicon.net
Sat Jan 8 23:37:24 CET 2005
On 7 Jan 2005 at 17:47, David M. Cooke wrote:
> On Sat, Jan 08, 2005 at 07:01:21AM +1100, sjmachin at lexicon.net wrote:
>> Sorry if you are seeing this again, but I sent it on Dec 31 and
>> didn't get my own copy back. As 2 other messages arrived from the
>> Pyrex list this morning, I'm trying again.
>> ------- Forwarded message follows -------
>> Hello all, > > Where in Python I would have at global level:
>> blah_table = (0, 1, 2, 42, 255)
>> or in C:
>> static const int blah_table[5] = {0, 1, 2, 42, 255};
>> Pyrex appears not to support (yet?) a statement like:
>> cdef int blah_table[5] = {0, 1, 2, 42, 255}
>
> You coult put your C version in a header file, and add (untested :-)
>
> cdef exterm from "constants.h":
> cdef extern int blah_table[5]
>
> to your Pyrex file.
>
Thanks very much. That does the job.
Hmmmm, one could drop in all sorts of interesting C code << evil grin >>
More information about the Pyrex
mailing list