logo       

[python] scoping of methods added via %extend: msg#00109

programming.swig

Subject: [python] scoping of methods added via %extend

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi--

Consider the following swig input:

- ----------------------------------------
%module question

class A {
public:
A() {}

%extend {
void foo() { int i=1; }
}
};
- ----------------------------------------

I generate wrappers using:
% swig -v -Wall -c++ -python -shadow question.i


In the resulting .cxx file, the scope of the wrapped function is
file-local (it has the static keyword):

static PyObject *_wrap_A_foo(PyObject *self, PyObject *args) { ... }

However, the scope of the added member function is global:

void A_foo(A *self){ int i=1; }

Is this intentional? These global symbols cause me problems on some
platforms. I'm using swig-1.3.17.

thanks--
Charles

- --
Charles Schwieters email: Charles.Schwieters@xxxxxxx
www: http://schwieters.org/cds
phone: (301) 402-4914 PGP key: http://schwieters.org/cds/pgp.txt

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQE+MFtMPK2zrJwS/lYRAjZeAJ4qGKvsPcLk8VChHG8BCAi8zfetowCffs30
iRAgQ9nfTvRSxNoW9EC8sJw=
=xZiG
-----END PGP SIGNATURE-----
_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise