Open VladimirIvan opened 7 years ago
The problem is related to the internal buffer used for the conversion. See this line: https://github.com/jaeandersson/swig/blob/matlab/Lib/matlab/matlabprimtypes.swg#L235
It might be needed to increase the size of this static buffer or use a dynamic array.
An std::string passed as an argument to a function from matlab fails the type check when the string length is greater than 255 characters. The
SWIG_Matlab_ConvertPtrAndOwn
method returns error in the first condition in it's body when checking formxGetNumberOfElements(pm_ptr) != 1
. The exact same code works correctly for shorter strings.To reproduce this, compile the following input file:
In matlab:
I have compiled the code with c++11 flags enabled.