[Pyrex] [Mac Inter Core Duo OS 10.4.9 ] Next question: cmd line build of init
Francesc Altet
faltet at carabos.com
Wed Jun 6 17:20:14 UTC 2007
El dc 06 de 06 del 2007 a les 09:52 -0700, en/na David Goldsmith va
escriure:
> Francesc Altet wrote:
> > [Please always reply to the list so that other people and help/learn
> > to/from you]
> >
> Sorry, I thought I did (I usually do) but I guess I forgot to this time. :-)
> > The problem is that you have defined GetNumVertices() as 'cdef' function
> > instead of 'def'. 'cdef' is the way to declare C functions but these
> > will not be callable from Python. Try this:
> >
> What if I want it to be callable from both?
In that case, you can do a wrapper in the next way:
def GetNumVertices():
return _GetNumVertices()
cdef public long _GetNumVertices():
if test_vals.nodes:
return test_vals.d.getNrows()
If you want to call from Python, call GetNumVertices(). If you want to
call the function from C, then call _GetNumVertices().
Cheers,
--
Francesc Altet | Be careful about using the following code --
Carabos Coop. V. | I've only proven that it works,
www.carabos.com | I haven't tested it. -- Donald Knuth
More information about the Pyrex
mailing list