[Pyrex] need help getting started
    horace 
    horace3d at gmail.com
       
    Thu Nov 17 14:45:37 CET 2005
    
    
  
hi,
i try to use pyrex to do a python binding for newton game dynamics (
www.newtondynamics.com <http://www.newtondynamics.com>) and would need some
help to get started.
the header looks like that:
typedef struct NewtonWorld{} NewtonWorld;
// Newton callback functions
typedef void* (*NewtonAllocMemory) (int sizeInBytes);
typedef void (*NewtonFreeMemory) (void *ptr, int sizeInBytes);
// world control functions
NEWTON_API NewtonWorld* NewtonCreate (NewtonAllocMemory malloc,
NewtonFreeMemory mfree);
NEWTON_API void NewtonDestroy (const NewtonWorld* newtonWorld);
and i have this pyrex file so far:
cdef extern from "newton.h":
 ctypedef struct NewtonWorld
 ctypedef NewtonAllocMemory
 ctypedef NewtonFreeMemory
 NewtonWorld* NewtonCreate(NewtonAllocMemory malloc, NewtonFreeMemory mfree)
 void NewtonDestroy(NewtonWorld* newtonWorld)
def create():
 cdef NewtonWorld* w
 w = NewtonCreate(NULL, NULL)
 return w
def destroy(world):
 cdef NewtonWorld* w
w = world
 NewtonDestroy(w)
the first problem is i have no idea how to ignore the memory management
callbacks. i don't need them so i tried to define incomplete types and pass
NULL but this doesn't work.
the second problem is i don't know how to pass the NewtonWorld pointer
around between python and pyrex?
it would be very nice if someone could give me some tips! probably i am too
inexperienced to do something like this since i only know python and no c
but i guess with some help for the first few functions maybe i could handle
it.
thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20051117/399f0978/attachment.html
    
    
More information about the Pyrex
mailing list