From: SourceForge.net <no...@so...> - 2009-11-14 15:04:38
|
Bugs item #2849219, was opened at 2009-09-02 15:39 Message generated for change (Settings changed) made by wsfulton You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2849219&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: python Group: None >Status: Closed >Resolution: Invalid Priority: 5 Private: No Submitted By: Michael Zalokar (mzalokar) >Assigned to: William Fulton (wsfulton) Summary: extern char* something[]; globals not handled correctly Initial Comment: I'm working on moving from python 1.1 to 1.3. The example works with swig 1.1p5, but not with swig 1.3.29 that came with my Linux distribution. If I'm doing something wrong I didn't find the correct way in the documentation. It looks like in swig 1.3 is not recognizing "char* somthing[]" as a "char **" like it used to in 1.1. I've included a small test example. First what works: bash-3.2$ swig -version SWIG Version 1.1 (Patch 5) Copyright (c) 1995-98 University of Utah and the Regents of the University of California Compiled with c++ bash-3.2$ make clean all rm -f *.o *.so swig -python -shadow test.i Generating wrappers for Python gcc -fPIC test_wrap.c -o test_wrap.o -c -I /fnal/ups/prd/python/v2_6_2_E_0/include/python2.6/ gcc -shared -o testcmodule.so test.c test_wrap.o gcc -shared -o _testmodule.so test.c test_wrap.o bash-3.2$ python -c "import test; print test.cvar.something" ['blah'] Now what does not work: bash-3.2$ swig -version SWIG Version 1.3.29 Compiled with g++ [x86_64-redhat-linux-gnu] Please see http://www.swig.org for reporting bugs and further information ash-3.2$ make clean all rm -f *.o *.so *.doc *.pyc swig -python -shadow test.i test.i:33: Warning(462): Unable to set dimensionless array variable gcc -fPIC test_wrap.c -o test_wrap.o -c -I /fnal/ups/prd/python/v2_6_2_E_0/include/python2.6/ gcc -shared -o testcmodule.so test.c test_wrap.o gcc -shared -o _testmodule.so test.c test_wrap.o bash-3.2$ python -c "import test; print test.cvar.something" <Swig Object of type 'char **' at 0x2b2ca4666de0> ---------------------------------------------------------------------- >Comment By: William Fulton (wsfulton) Date: 2009-11-14 15:04 Message: Variables use the varout typemap for Python in swig-1.3. Also the type to use is more appropriate. Please change your typemap to: %typemap (varout) char *[] { ... } then it works. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2849219&group_id=1645 |