I would like to call a C function from python. This C function is void, thus the "return parameters" (data I want to change) are defined as pointers in the C function's definition.
The function in C looks like this (note: I cannot and will not change it as it is generated automatically by MATLAB codegen):
void func(int   *input_var,    // input
          float *output_var    //output
         ) {
    ... 
}
from python, I am calling my function as so
import ctypes as C
func = C.CDLL('path/to/lib.so').func
input_var = C.c_int(5)
output_var = C.POINTER(C.c_float) # basically want to just declare a pointer here
func(C.byref(input_var), C.byref(output_var))
The error I get is
TypeError: byref() argument must be a ctypes instance, not '_ctypes.PyCPointerType'
if I remove bref() I get
ctypes.ArgumentError: argument 2: <class 'TypeError'>: Don't know how to convert parameter 2
I also tried to pass in output_var as C.byref(output_var()); this leads to a Segmentation fault (core dumped)