Say I have an example.h
file with following:
struct foo_bar {
int x;
};
struct foo {
struct {
int y;
} bar;
};
and example.i
with following:
%module example
%{
#include "example.h"
%}
%include "example.h"
Now, when I generate the SWIG wrapper, SWIG defines a new struct foo_bar
to access the nested bar
struct in foo
(also mentioned in the documentation). However this is causing foo_bar
struct to be duplicated and it is failing the compilation.
So, how can I ask SWIG to use foo2
when SWIG creates custom structs to access nested structs of foo
, so that all nested structs for foo
are created like foo2_bar
? I tried %rename
but it only renames the wrapper functions, not the custom structs created by SWIG to access nested structs.