Hi I am opening a shared library which has defined the following callback prototype: extern void DebugMessage(int level, const char *message, ...);
My implementation in Python looks like this: DEBUGFUNC = ctypes.CFUNCTYPE(None, ctypes.c_int, ctypes.POINTER(ctypes.c_char)) def DebugMessage(lvl, msg): print lvl, msg return debug_callback = DEBUGFUNC(DebugMessage) Which gives me the following when running my python script: 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> 0 <ctypes.LP_c_char object at 0x7f872d5148c0> How can I get something useful? If I change the print to: print lvl, msg[0], it produces an Segfault -- http://mail.python.org/mailman/listinfo/python-list