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

人走茶凉 提交于 2019-12-13 17:43:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!