When using SWIG 2.0.5 for building Python MapScript it reports "AttributeError: No constructor defined" when trying to initialize a new mapObj. Using SWIG 2.0.4 works though.
seems like a swig issue, nothing much we can do about it aside from keeping this available as reference if someone has the same issue. For info, I've tested these versions:
reopening, seems to be another issue
demilestoning since there's a workaround (use 2.0.4) and no one wants to tackle the issue right away.
fix for recent swig builds (#4325)
The error was arising because swig in recent versions is ignoring constructors who's name doesn't match the original c-struct name, namely for mapObj, layerObj, classObj and errorObj which are defined as map_obj, layer_obj, class_obj and error_obj.
This can be seen by this kind of warning message when running swig:
../swiginc/class.i:66: Warning 504: Function class_obj::classObj(layerObj *) must have a return type. Ignored.
../swiginc/class.i:77: Warning 521: Illegal destructor name class_obj::~classObj(). Ignored.
The proposed fix changes our use of map_obj into mapObj everywhere, which fixes this swig issue. However I fear that this is going to have some side effects as some compilers might be upset by this change. For reference, the commit that first introduced this notation is a332c37 (yeah, that's old :) )
@szekerest @jmckenna : can you please check that this new code still compiles on your windows buildkits ?
git remote add tbonfort git://github.com/tbonfort/mapserver.git
git fetch tbonfort
git checkout swig-fixes
#normal windows build as if it was master
maybe @dmorissette has some insight as to why this syntax was used ?
tested the proposed fix on an old compiler (gcc 3.4.6 from centos 4) and it compiles fine. waiting on the windows guys...
can confirm this works on debian 6.0 with swig 2.0.7
fix mapscript builds for recent swig versions (#4325)
applied to 6.2, recent swig versions produce buildable/runnable code, along with some build fixes for java and ruby