import ctypes dll = ctypes.CDLL('./x.so') f = dll.func f.argtypes = [ctypes.c_long] * 7 f.restype = ctypes.c_long f(1, 2, 3, 4, 5, 6, 7)