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:
struct interface
{
    int a;
    int b;
    char *c;
}

the Python ctype port of this structur would be:

class INTERFACE(Structure):
    _fields_ = [("a"         c_int),
                      ("b",        c_int),
                      ("c",         c_char)]

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?

Thank you..

sincerely chris


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to