[Pyrex] "Language Overview" confusion

David Goldsmith David.L.Goldsmith at noaa.gov
Tue Jun 5 23:34:38 UTC 2007


John Machin wrote:
> 1. If you start at the major heading "External Declarations", you will 
> see that the two declarations are what it has been talking about it 
> all along.
I did start there but did not "see"...
> 2. Consider that documentation that you read may have been written in 
> a dialect of English other than your own. It's perfectly clear to me, 
But I imagine you already knew what it was saying before you read it, 
i.e., I don't think it's a dialect problem, but rather a failure to see 
what's written with the eyes of someone who has no idea what they're 
supposed to be doing.
> but then I'm also from the Antipodes :-)
"Antipodes" = "Down Under"?

OK, from your previous email, I understand it thusly: the "cdef extern 
from ..." line is what generates the appropriate #include in the pyrex 
generated C file, but that's all it does; any variables and/or functions 
from the header that one wants to use in the Pyrex file itself need to 
be declared in a block following that cdef line (and nowhere else), but 
if one does *not* want to use *any* such variables/functions in the 
Pyrex file, then one can (must?) include a pass statement in the block 
followin the cdef extern from line.  In other words:

  cdef extern from "spam.h": # this line adds the #include to the C file

    int spam_counter # this is only necessary if spam_counter is to be 
used in this Pyrex file, but if
                                # needed, it needs to be in this block

    void order_spam(int tons) # ditto w.r.t. the function order_spam

    pass # this is all I would need if I didn't need anything from 
spam.h in this Pyrex file

Is this correct?  Thanks!

DG
-- 
ERD/ORR/NOS/NOAA <http://response.restoration.noaa.gov/emergencyresponse/>



More information about the Pyrex mailing list