Skip to content Skip to sidebar Skip to footer

Swig Function With Pointer Struct

Im new using SWIG to wrapped C shared library. I have problem to call a C function with Struct pointer in python. My files: ST_Param.h: typedef struct { unsigned int* device

Solution 1:

You do this essentially the same way you do it in C: You first create a ST_param_ST struct and then pass this to the initialization function ST_Param_Initialize(). Here is an example in Python, assuming your module is called ex:

>>> import ex
>>> ST_Param = ex.ST_param_ST()
>>> ex.ST_Param_Initialize(ST_param, 42)

Post a Comment for "Swig Function With Pointer Struct"