0

How to wrap this

class Foobar {
public:
    int member[];
}

in SWIG, without changing this C++ code??

Here is an excellent post that explains a lot,

SWIG/python array inside structure

but the way it works, you have to change the C++ code to make it possible to wrap. I can't do that.

Community
  • 1
  • 1
Mark Galeck
  • 6,155
  • 1
  • 28
  • 55

1 Answers1

0

Well it seems, like I can just go a step further than in SWIG/python array inside structure I change the above original code foobar.h to :

class Foobar {
public:
    int_array_wrapper member;
}

and then, I can both #include and %include this foobar_modified_for_swig.h in my SWIG interface code, at the same time, the original foobar.cpp will still use foobar.h and the two link together and appear to work. Not sure why this works but it seems to work.

Community
  • 1
  • 1
Mark Galeck
  • 6,155
  • 1
  • 28
  • 55