On Oct 16, 2007, at 10:25 AM, John Voight wrote:

>
> Hi Robert,
>
> I can't seem to get primessq to be defined as a cdef long*.  I've
> tried
>   cdef long primessq[46] = [...]
>   cdef long *primessq = [...]
> etc. and they always give errors.

This is because [...] creates a python list, which is a PyObject* and  
can't be assigned to a long*. You would have to do something like

cdef long primessq[46]
py_primes = [...]
for i from 0 <= i < 46:
        primessqi] = py_primes[i] # this does a python object -> long  
conversion.

> Cython doesn't allow you to use
> macros (#define) I guess?

You can define macros in a .h file, then cimport them, but you can't  
define macros directly in the cython file.

- Robert

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to