How to map size_t using ctypes?

Philip Semanchuk philip at semanchuk.com
Mon Jul 6 15:51:58 CEST 2009


Hi all,
I can't figure out how to map a C variable of size_t via Python's  
ctypes module. Let's say I have a C function like this:

void populate_big_array(double *the_array, size_t element_count) {...}

How would I pass parameter 2? A long (or ulong) will (probably) work  
(on most platforms), but I like my code to be more robust than that.  
Furthermore, this is scientific code and it's entirely possible that  
someone will want to pass a huge array with more elements than can be  
described by a 32-bit long.


Suggestions appreciated.

Thanks
Philip



More information about the Python-list mailing list