Sorry guys, but here is my post again with some important information edited in.

I'm using %array_class(int, intArray) to be able to pass an array reference to my my cpp-code from the python interpreter.
The cpp-function uses the reference to fill the array with values, but when I dereference the array from python odd indexes contain random data and even indexes contain what they are supposed to.

I've created a test case where the value of index 0 should contain value 0, index 1 should contain value 1, index 2 should contain value 2 and so on.
What I get is:

    Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
    [GCC 4.5.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import test
    >>> a = test.intArray(20)
    >>> test.getVector(a, 20)
    >>> a[0]
    >>> a[1]
    >>> a[2]
    >>> a[3]
    >>> a[4]

I'm on a 64-bit box so I'm pretty sure there is some mix up of what's to be interpreted as 32-bit and what's to be interpreted as 64-bits, but I'm very confused as to where this problem is introduced and how to amend it. I'm using swig 1.3.40 and compiling with g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2.

These are the flags and paramers used:

    swig -python -c++ test.i
    g++ -c -fpic test.cpp test_wrap.cxx -I/usr/include/python2.7
    g++ -shared test.o test_wrap.o -o

Any ideas?

Best regards,