In C, I can write
foobar.h:
typedef int ARR[2];
foobar.c:
#include "foobar.h"
ARR arr;
and now I have an array arr of the proper size. I can obtain that array without having to know the size, I just know the name of the type ARR. In other words, the header file hides the implementation details of ARR - the principle of encapsulation.
Now I want to translate this with SWIG to Python. I have an interface
foobar.i:
%{
#include "foobar.h"
%}
%include "foobar.h"
and that means to me, just as above, that I should be able to use the interface coming out of foobar.h without having to know the details. That is, I want to use the word ARR somehow on Python command line, to get an array of the correct size (perhaps initialized, in Python everything is initialized).
I am not trying to repeat C syntax in Python. I want to repeat the principle of encapsulation.
What do I need to add to the interface to accomplish that?
I am trying and trying and can't figure it out.