I have a C function that takes as paramenter an 8 bit integer
int8_t foo( int8_t x );
I would like to call this function from my python code using a swig interface but int8_t type do not exists in python. In order to have this kind of types exists a python module called numpy. Even using this yet I do not manage to make the 2 comunicating.
Do you know if there is any way of defining such a type in the SWIG interfacve in order to be able to use it from python??
int8_t is just an example... i have to do the same for signed/unsigned from 8 up to 64 bits
Thanks in advance, S.
In your SWIG interface file use:
%include "stdint.i"
before you first use uint8_t
. SWIG will then apply an appropriate typemap for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With