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_Address;
....
....
unsigned int lock;
}ST_param_ST;
unsigned char ST_Param_Initialize(ST_param_ST * ST_param, unsigned int device_Address);
ST_Param.c
......... Rest of file.............
unsigned char ST_Param_Initialize(ST_param_ST * ST_param, unsigned int device_Address){
if(ST_param == NULL){
.......... rest of funtion .......................
return 0;
}
Within ST_Param_Initialize I confirm that the pointer exists, if not believe
ST_Param.i:
/* File : ST_Param.i */
%module ST_Param
%{
#define SWIG_FILE_WITH_INIT
#include "ST_Param.h"
%}
%include "typemaps.i"
%include "ST_Param.h"
I compiled and generated a .so file good. In python I can import a library but I cant call a ST_Param_Initialize because a need a ST_Param_ST * parameter:
ST_param_ST * error
How can I do this?
Note: i cant modify a .c and .h file. Only a .i file.
A search in google but I dont understand how to do it
Thanks Regards.