[Pyrex] void *

Bryan Weingarten bryan.weingarten at pobox.com
Sat Oct 18 06:13:59 CEST 2003


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):           
        self.ctx = mpgedit_play_init()        
        
    def __del__(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