I am learning C library wrapping in cython. I compiled a couple of simple C function and header files using cython and now am trying to run another example which is more complicated one than previous examples.
I downloaded very first version of Sundials C source code (IDA module only) and made a *.lib using VS 2019. Now I am trying to wrap just one function to see how it works. However I couldn't figure out how to properly wrap a function with void * argument to cython function. Here is the example.
The ida_mem
is void pointer to an address of an allocated memory from C malloc
function. How should I
call IDACalcIC
function at the bottom with correct pointer argument ?
IDA.pyx file
cdef extern from "ida.h":
ctypedef double real;
ctypedef int integer;
int IDACalcIC(void *ida_mem, int icopt, real tout1, real epicfac, int maxnh, int maxnj, int maxnit, int lsoff, real steptol)
cpdef CyIDACalcIC(void *ida_mem, icopt, tout1, epicfac, maxnh, maxnj, maxnit, lsoff, steptol):
cdef int icopt
cdef int maxnh
cdef int maxnj
cdef int maxnit
cdef int lsoff
cdef real tout1
cdef real epicfac
cdef real steptol
IDACalcIC(ida_mem (?), icopt, tout1, epicfac, maxnh, maxnj, maxnit, lsoff, steptol)