Call by reference in SWIG?

Nok nils.krahnstoever at
Thu Dec 11 06:19:51 CET 2008

I can't get call-by-reference functions to work in SWIG...

Even when wrapping a trivial example like this:

/* File : trivial.i */
%module trivial
  class test
    void foo(int *t)

I get a TypeError when trying to use it:

import trivial


The error is:

    def foo(*args): return _trivial.test_foo(*args)
TypeError: in method 'test_foo', argument 2 of type 'int &'

More information about the Python-list mailing list