问题
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;
回答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;
来源:https://stackoverflow.com/questions/8440115/how-to-rename-swig-generated-proxy-java-classes-created-from-c-structures