[BUG][WIN] Simulink and python interface
In current Release, simulink always return the error code 126 (dll not found).
Error using start_MPC (line 17) Error while obtaining sizes from MEX S-function 'MBsysC_SF_dirdyn' in 'MPC_CartPendulum/S-Function'. Caused by: Error using start_MPC (line 17) DLL Failed To Load with error 126
History and origin
- In the past we loaded the (symbolic & userfct) libraries in the folder PRJ/workR/build/Debug.
- In af6eaa44 (Jul. 2016), we add the possibility to specify the build directory and the lib were loaded from folder BuildPath/Debug.
- In 4a9e2329 (Sept 2017), we automatically detect Visual Studio build the project in Release or Debug (see in build/conf/cmake_config.h) and load the libraries from the corresponding folder. For retro-compatibility, if the path provided to loading functions did not contain the configuration (Debug or Release) we use by default the Debug.
- In 61d548db (Feb. 2018), we removed this retro-compatibility.
When running from Simulink, the file cmake_config.h is not used for loading the libraries (and anyway, the flag _Debug is not defined). In simulink the build path is defined in the mbs_sf_fct.c file and do not include Debug or Release subfolder.
Temporary fix (to to in user local folder)
Modify the MBsysC/mbs_common/mbs_load_xml/mbs_load_libraries.c file and reset the change from commit 61d548db.
Definitive fix possibilities
- Add a check in mbs_sf_fct.c that see where the .dll are (in /Debug or /Release). Then it should select the folder containing the dll. This solution does not allow the user to select the build version.
- Add a box in Simulink to let the user select by himself the build version (Debug or Release). Then give this information to the function mbs_sf_load_data in mbs_sf_fct.c and select the corresponding folder. This solution add useless information in simulink for Linux
- Any other idea is welcome.