grimson at gmx.de
Tue Jan 13 17:22:24 CET 2009
hello out there,
I have a problem with c-types.
I made a c-library, which expects a pointer to a self defined structure.
let the funtion call myfunction(struct interface* iface)
and the struct:
the Python ctype port of this structur would be:
_fields_ = [("a" c_int),
in my python-struct a create a instance of INTERFACE
myiface = INTERFACE()
myiface.a = ctypes.c_int(80)
myiface.b = ctypes.c_int(22)
than I make a pointer onto it.
p_iface = ctypes.pointer(myiface)
and I tried it also with a reference
r_iface = ctypes.byref(myiface)
but neither myclib.myfunction(p_iface) nor myclib.myfunction(r_iface)
works properly. The function is been called but it reads only zeros (0)
for each parameter (member in the struct).
Where is my fault?
More information about the Python-list