ctypes: return a pointer to a struct

Jack nospam at invalid.com
Fri Apr 25 05:09:33 CEST 2008

I'm not able to build IP2Location's Python interface so I'm
trying to use ctypes to call its C interface. The functions
return a pointer to the struct below. I haven't been able to
figure out how I should declare the return type of the functions
and read the fields. Any hint is appreciated.

typedef struct
 char *country_short;
 char *country_long;
 char *region;
 char *city;
 char *isp;
 float latitude;
 float longitude;
 char *domain;
 char *zipcode;
 char *timezone;
 char *netspeed;
} IP2LocationRecord; 

More information about the Python-list mailing list