If you don't mind NumPy being one of your requirements, you can do:
from numpy cimport int64_t
Please do not top-post...
> On Tue, Aug 17, 2010 at 2:03 PM, Jeff <jeff....@pnl.gov> wrote:
>> I'm trying to wrap a C library which has a number of functions which
>> take an int64_t parameter. This is a piece of my pxd file wrapping
>> the C library's header:
>>
>> from stdio cimport *
>> from stdlib cimport *
>> from stdint cimport *
>>
>> cdef extern from "ga.h":
>> void GA_Abs_value_patch64(int g_a, int64_t *lo, int64_t *hi)
>>
>> But this produces errors such as "'int64_t' is not a type identifier"
>> and "undeclared name not builtin: int64_t".
>> I need this to work on 32- and 64-bit platforms, so... did I miss
>> something obvious? Thanks.
>
In cython-devel (to be released VERY soon) there is fairly good
support for C99 integrals:
http://hg.cython.org/cython-devel/file/tip/Cython/Includes/libc/stdint.pxd
So, you just need to write:
from libc.stdint cimport int64_t
--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
Sorry about that. My heuristic was:
if list is on Google Groups: top post
else: bottom post
Will have to pay more attention to that.
No problem, unless you've been on this list a while you wouldn't know.
As for the original question, you could also declare it directly, just
as we will in the next release:
cdef extern from "stdint.h":
ctypedef signed int int64_t
http://hg.cython.org/cython-devel/file/2bac73e04f8b/Cython/Includes/libc/stdint.pxd#l1
- Robert