Passing FILE * types using ctypes

Neil Hodgson nyamatongwe+thunder at gmail.com
Fri Mar 5 16:45:54 EST 2010


Zeeshan Quireshi:

> Hello, I'm using ctypes to wrap a library i wrote. I am trying to pass
> it a FILE *pointer, how do i open a file in Python and convert it to a
> FILE *pointer.

   For this to work, your library should have been compiled with the
same compiler as Python and possibly the same compiler options such as
choice of runtime library. Otherwise, they may differ in the content and
layout of FILE and also in behaviour. On Unix, this may not be a problem
because of the shared runtime but on Windows it can cause crashes.

   Neil



More information about the Python-list mailing list