Calling C from Python

Suppose we have a C function
extern double hw1(double r1, double r2);
We want to call this from Python as
from hw import hw1
r1 = 1.2; r2 = -1.2
s = hw1(r1, r2)
The Python variables r1 and r2 hold numbers (float), we need to extract these in the C code, convert to double variables, then call hw1, and finally convert the double result to a Python float
All this conversion is done in wrapper code

previousnexttable of contents