c12
c12

Reputation: 9827

How to Rename SWIG Generated Proxy Java classes created from C Structures

I have a few C structures like below that are generated by SWIG into sample_struct_t.java since the C function declares it as sample_struct_t. What would I need to add to the SWIG interface file to generate the sample_struct_t structure as Sample.java?

typedef struct sample_struct_t_ {
    char                               *sample;
    uint8_t                             example;
    ios_boolean                         remove;
} sample_struct_t;

Upvotes: 1

Views: 1404

Answers (1)

You need to use %rename with the non-typedef'd (i.e. original) name, before this is first seen:

%module test

%rename (Sample) sample_struct_t_;

typedef struct sample_struct_t_ {
    char                               *sample;
    uint8_t                             example;
    ios_boolean                         remove;
} sample_struct_t;

Upvotes: 1

Related Questions