Re: extracting null pointer address from PyCObject with ctypes

2008-10-11 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: ctypes.pythonapi.PyCObject_AsVoidPtr.restype > ctypes.pythonapi.PyCObject_AsVoidPtr.argtypes thank you so much, this works perfectly :) -- Gord Allott ([EMAIL PROTECTED]) signature.asc Description: OpenPGP digital signature -- http://mail.pytho

Re: extracting null pointer address from PyCObject with ctypes

2008-10-11 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > > What does print pythonapi.PyCObject_AsVoidPtr(display) give you? > -- > http://mail.python.org/mailman/listinfo/python-list Traceback (most recent call last): File "pygametest.py", line 125, in app = PyGameOGREApp() File "pygametest.py", line 33, in __

Re: extracting null pointer address from PyCObject with ctypes

2008-10-11 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > > My pygame install just returns an integer in get_wm_info. Take a > look: > pygame.display.get_wm_info() > {'window': 1180066, 'hglrc': 0} pygame.display.get_wm_info()['window'] > 1180066 ctypes.c_void_p( _ ) > c_void_p(1180066) > > You're sugge

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > > You are hard to follow. There is the 'cast' function, which I've had > some success with, even in adding pointers and offsets. It took a > look at the code for it though, and calling an undocumented version of > it. I can post that later if you don't have luc

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > Yes, well said. But no, not true, not necessarily. You can choose/ > change return types with your code. If the call is defined already > and you can't change the return, just define a new one that returns > long. > -- > http://mail.python.org/mailman/listinfo/

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > I see. If I understand, you have a PyCObject in a dictionary. > > Look at the 'ctypes' module and try calling PyCObject_AsVoidPtr. Its > return type should be 'c_void_p', and you can use 'result.value' to > get the original pointer. > -- > http://mail.python.org

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > Did you try: > > tmp= PyLong_FromLong( ( long ) info.info.x11.display ); > PyDict_SetItemString (dict, "display", tmp); > Py_DECREF (tmp); > > Or also try: > > PyCObject_AsVoidPtr( tmp ); > -- > http://mail.python.org/mailman/listinfo/python-list the problem is

extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Hello :) The result of various incompatibilities has left me needing to somehow extract the address that a null pointer is pointing to with the null pointer being exposed to python via PyCObject_FromVoidPtr the code that creates the PyCObject is as follows: tmp = PyCObject_FromVoidPtr (info.i