C_word type / Cython (warning: passing argument 2 from incompatible pointer type)

21 views
Skip to first unread message

David Dreisigmeyer

unread,
Feb 11, 2011, 4:57:50 PM2/11/11
to chicke...@nongnu.org, cython...@googlegroups.com, David Dreisigmeyer
Here's my setup:

OSX 10.6.6
Chicken 4.6.0
Python 2.7.1
Cython 0.14

** The Chicken part:

What type is C_word? The only thing I see is this in chicken.h

#ifdef C_SIXTY_FOUR
# define C_word long
# define C_u32 uint32_t
# define C_s32 int32_t
#else
# define C_word int
# define C_u32 unsigned int
# define C_s32 int
#endif

but I get the following warning:

warning: passing argument 2 of ‘CHICKEN_eval_string’ from incompatible
pointer type


** The Cython part:

I'm trying to use this with Cython, so I have (in my *.pxd):

ctypedef long C_word (Note: I tried ctypedef int C_word also.)

cdef extern from "chicken.h":
int CHICKEN_eval_string(char *, C_word *)

cdef inline C_word C_chick_eval_s (char *IN_STR):
cdef C_word OUT_RESULT
status = CHICKEN_eval_string(IN_STR, &OUT_RESULT)
if (status == 0):
print "Chicken evaluation failed"
elif (str(OUT_RESULT) == '#<unspecified>'):
pass
else:
print OUT_RESULT
return OUT_RESULT


Thanks!

-Dave

Lisandro Dalcin

unread,
Feb 11, 2011, 5:40:43 PM2/11/11
to cython...@googlegroups.com
On 11 February 2011 18:57, David Dreisigmeyer <dwdreis...@gmail.com> wrote:
> Here's my setup:
>
> OSX 10.6.6
> Chicken 4.6.0
> Python 2.7.1
> Cython 0.14
>
> ** The Chicken part:
>
> What type is C_word?  The only thing I see is this in chicken.h
>
> #ifdef C_SIXTY_FOUR
> # define C_word                   long
> # define C_u32                    uint32_t
> # define C_s32                    int32_t
> #else
> # define C_word                   int
> # define C_u32                    unsigned int
> # define C_s32                    int
> #endif
>
> but I get the following warning:
>
> warning: passing argument 2 of ‘CHICKEN_eval_string’ from incompatible
> pointer type
>
>
> ** The Cython part:
>
> I'm trying to use this with Cython, so I have (in my *.pxd):
>
> ctypedef long C_word (Note: I tried ctypedef int C_word also.)
>

Please add the ctypedef inside the cdef extern block below, and you
should be done...

> cdef extern from "chicken.h":
>    int CHICKEN_eval_string(char *, C_word *)
>
> cdef inline C_word C_chick_eval_s (char *IN_STR):
>    cdef C_word OUT_RESULT
>    status = CHICKEN_eval_string(IN_STR, &OUT_RESULT)
>    if (status == 0):
>        print "Chicken evaluation failed"
>    elif (str(OUT_RESULT) == '#<unspecified>'):
>        pass
>    else:
>        print OUT_RESULT
>    return OUT_RESULT
>
>
> Thanks!
>
> -Dave
>

--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

David Dreisigmeyer

unread,
Feb 11, 2011, 5:43:12 PM2/11/11
to cython...@googlegroups.com
That worked. Thanks, -Dave
Reply all
Reply to author
Forward
0 new messages