[Pyrex] void *

Bryan Weingarten bryan.weingarten at pobox.com
Sun Oct 19 01:12:54 CEST 2003


sorry about the extra cut&paste lines in my first post, so i'm posting 
it again.

---------------------

i'm wrapping a c api that is similar to this:

void * foo_init();
void    foo_close(void *ctx);

i've successfully wrapped and tested it but i'm getting compiler 
warnings that i would like to get rid of.

i was unable to get pyrex to work the void * so i told pyrex that the 
function prototypes are int's:

cdef extern from "foo.h":
   int    foo_init()
   void foo_close(int ctx)

class Foo:
   def __init__(self):            
       foo_close(self.ctx)
     
but this causes warnings like this:

mpgedit.c(73) : warning C4047: 'function' : 'long ' differs in levels of 
indirection from 'void *'
mpgedit.c(73) : warning C4024: 'PyInt_FromLong' : different types for 
formal and actual parameter 1
mpgedit.c(105) : warning C4022: foo_close' : pointer mismatch for actual 
parameter 1

is there a better way to hand the void * instead of pretending it's an int?

thanks for any help,

bryan

>





More information about the Pyrex mailing list