I understand how to define structs in Python with ctypes, but I can’t seem to find any documentation on how to handle basic aliases. For example 64-bit integers in SQLite:
#ifdef SQLITE_INT64_TYPE
typedef SQLITE_INT64_TYPE sqlite_int64;
typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
#elif defined(_MSC_VER) || defined(__BORLANDC__)
typedef __int64 sqlite_int64;
typedef unsigned __int64 sqlite_uint64;
#else
typedef long long int sqlite_int64;
typedef unsigned long long int sqlite_uint64;
#endif
typedef sqlite_int64 sqlite3_int64;
typedef sqlite_uint64 sqlite3_uint64;
Depending on the build options, the basic type is different. In this case, I think I can make an assumption that the type is c_longlong, but is that the correct way to handle this situation?
While this certainly isn’t the ‘correct’ way to handle this, short of using the C API instead of
ctypes, this is the only solution. By the timectypesruns, the typedef information has been removed – it doesn’t appear as symbols in the compiled library.