Skip to content

fix std::vector<double> problem with SWIG 4.2.x

Boman Romain requested to merge boman into master

The tests of waves (in amfe-solvers) failed on Ubuntu 24.04 due to a problem coming from the new version of SWIG (4.2.0) installed with this linux release.

The class std_vector_double was defined in tbox.i, but now it is now defined in fwk.i.

The problem came from the fact that std::vector<double> is a type seen by SWIG in fwk.

In previous version of SWIG (<4.2.0), SWIG was able to understand that std::vector<double> in fwk was the same as std::vector<double> in tbox where the bindings were instanciated by the %template command. From 4.2.0, swig fails to understand that link and the __setitem__ generates a cast failure.

A test has been added to the tests of fwk (stdvec.py)

Note: the docker image has been upgraded to 24.04 and contains the newest version of SWIG (4.2.1).

Edited by Boman Romain

Merge request reports