I’m trying to wrap a dummy C libray using Cython.
Here is the .h file of the library…
void say_hello(char *name);
double multiply(double x, double y);
int divide(double x, double y, double *answer);
I have no problem wrapping the first 2 functions with cython but am having trouble wrapping the 3rd.
The third function divides x by y and returns the answer in the third pointer to a double argument. The function itself returns either success or fail.
The actual library that I’d like to wrap is full of these kinds of situations where it returns a status code and the actual output of the functions are returned via pointers.
What is the proper way to wrap such functions?
Thanks,
~Eric
you have to allocate answer on the stack. Cython will take care of the rest.