From: Christian Szegedy Date: 2002-06-14T00:04:57+09:00 Subject: Re: SWIG questions This is a multi-part message in MIME format. --------------080804040305020305030302 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit >> I was surprised to notice that SWIG generates >> singleton setter and getter methods for a namespace. >> Is there a reason for that? > > > I don't know what you're talking about here. Could you be more specific? > I changed the example provided with SWIG in Examples/class, so that the class is enclosed in a namespace ABC. I left the exmample.i file unchanged. SWIG generated the wrapper code in the attached file. (I deleted everything up to the init function.) I used SWIG-1.3.12. Best regards, Christian --------------080804040305020305030302 Content-Type: text/plain; name="wrap.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="wrap.cpp" void Init_example(void) { int i; mExample = rb_define_module("Example"); _mSWIG = rb_define_module_under(mExample, "SWIG"); for (i = 0; swig_types_initial[i]; i++) { swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); SWIG_define_class(swig_types[i]); } rb_define_singleton_method(mExample, "ABC", VALUEFUNC(ABC_get), 0); rb_define_singleton_method(mExample, "ABC=", VALUEFUNC(ABC_set), 1); } --------------080804040305020305030302--