[Jnaerator, Bridj] Problem with inner struct in the generated code.
ochafik opened this issue · comments
From @mcolmant on August 12, 2014 9:30
Hello,
I have a lot of inner structs in a header file. For example:
typedef struct {
const char *name; /* event name */
const char *desc; /* event description */
size_t size; /* struct sizeof */
pfm_pmu_t pmu; /* PMU identification */
pfm_pmu_type_t type; /* PMU type */
int nevents; /* how many events for this PMU */
int first_event; /* opaque index of first event */
int max_encoding; /* max number of uint64_t to encode an event */
int num_cntrs; /* number of generic counters */
int num_fixed_cntrs;/* number of fixed counters */
struct {
unsigned int is_present:1; /* present on host system */
unsigned int is_dfl:1; /* is architecture default PMU */
unsigned int reserved_bits:30;
} SWIG_NAME(flags);
} pfm_pmu_info_t;
We chose to generate one class for each typedef struct (default behavior). So, as expected, one static class called field1_struct is generated to represent the inner struct and one attribute is created to represent it (field1). But the type of this attribute is not the right one. It corresponds to another struct defined elsewhere. This wrong type is chosen for all the inner struct.
Copied from original issue: nativelibs4java/nativelibs4java#522