Swig and PHP: C function expects enum as argument -
i have c function looks this:
getcurrentmode(radiomodes *radiomodes);
and both .h file , swigs .i file contain these enum definition:
typedef enum _radiomodes { radiomodes_none = 0, radiomodes_one = 1, radiomodes_two = 2, } radiomodes;
getcurrentmode should set $rcs correct mode. when run:
$rcs = radiomodes_none; getcurrentmode($rcs);
i these error: php fatal error: type error in argument 1 of getcurrentmode. expected swigtype_p__radiomodes
how swig , php set $rcs correct enum? or how swig convert enum radiomode int , back?
solved: issue needed add pointer function after .h file defined.
%pointer_functions( radiomodes, radiomodesp )
this added several new functions can use in php.
Comments
Post a Comment