What is the best way to pass many parameters to cffi extension?

Hello. I am writing a c extension to build a custom function. However, it has many parameter, most of which is to specify the random number distribution. If directly pass all the parameter to the call of c function, the parameter list will become too long… Is there a clever way to deal with this situation?

I think passing a struct from python to c should be a method.

I try the code:

int affine_crop_forward_cuda(void* ttin){
    struct teststruct *tt = (struct teststruct*)ttin;
    printf("first:\t%f\nsecond:\t%f\nthird:\t%cforth:\t%c\n", tt->mean, tt->variance, tt->flag_set, tt->flag_uniform);
    return 1;


class teststruct(ctypes.Structure):
    _fields_ = [
        ("mean",		ctypes.c_float),  
        ("variance",	ctypes.c_float), 
        ("flag_set", 	ctypes.c_ubyte),
class AffineCropFunction(Function):
	def __init__(self, mean, variance, flag_set, flag_uniform):
		super(AffineCropFunction, self).__init__()
		self.tt = teststruct()
		self.tt.mean = ctypes.c_float(mean)
		self.tt.variance = ctypes.c_float(variance)
		self.tt.flag_set = ctypes.c_ubyte(flag_set)
		self.tt.flag_uniform = ctypes.c_ubyte(flag_uniform)

however when invoke the c extension, there is a error TypeError: initializer for ctype 'void *' must be a cdata pointer, not c_void_p.
I try a lot and search online, can’t find what is the right way to pass the pointer in python code.
Can anyone help me out? Thanks.