I am using ctypes to wrap a C-library (which I have control over) with Python. I want to wrap a C-function with declaration:
int fread_int( FILE * stream );
If you want to use stdout/stdin/stderr, you can import those variables from the standard C library.
libc = ctypes.cdll.LoadLibrary('libc.so.6')
cstdout = ctypes.c_void_p.in_dll(libc, 'stdout')
Or, if you want to avoid using void* for some reason:
class FILE(ctypes.Structure):
pass
FILE_p = ctypes.POINTER(FILE)
libc = ctypes.cdll.LoadLibrary('libc.so.6')
cstdout = FILE_p.in_dll(libc, 'stdout')