Reputation: 2842
I'm trying to call a C function from python. This function takes a number of arrays as input and returns a float.
Do I need a SWIG typemap to do this? One concern is that python doesn't make a distinction between floats
, double
, etc and I'm specifically interested in returning only c-type float
.
Upvotes: 2
Views: 87
Reputation: 177901
Returning float
"just works". You don't need additional typemaps:
test.i
%module test
%inline %{
float func(void) { return 1.5; }
%}
After running swig and compiling the result:
>>> import test
>>> test.func()
1.5
Upvotes: 2