i am using SWIG to build a python interface from C source code. I have a header file with a bunch of values defined. Some of those definitions use a type defined in another header file. I am including this header file (and %importing) it in my SWIG interface file. I still don't get these defined values in my generated interface.
Here is the C header "control_params.h", of which I want to generate an interface from:
#include "my_enums.h"
#define MOTOR_SIZE (10U)
#define CHARGER_RATE_PERCENT (PERCENT_5)
Here is the other header "my_enums.h" that has the type defintion of PERCENT_5:
/** Some helpers for percent values */
typedef enum percent
{
PERCENT_0 = 0,
PERCENT_5 = 5,
PERCENT_10 = 10
} ePercent;
Here is my SWIG interface "control_param_interface.i":
%module control_param_interface
%{
#include "my_enums.h"
#include "control_params.h"
%}
%import my_enums.h
%include control_params.h
The result is that MOTOR_SIZE gets successfully wrapped, but SWIG is unable to process CHARGER_RATE_PERCENT:
Relevant section from the generated control_param_interface.py:
MOTOR_SIZE = _control_param_interface.MOTOR_SIZE
As you can see, code for CHARGER_RATE_PERCENT is missing :/