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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.