Open Thandre opened 3 months ago
When I try the steps with Python 3.6 everything works fine. It seems to be a Windows specific issue that was introduced in Python 3.8 (Link).
Does adding os.add_dll_directory(dir)
to the for loop at model.py fix the issue? If so, I can push a fix.
This was also my first thought. Unfortunately this doesn't solve the issue. Maybe the path has to be adjusted as well. According to this comment the backslashes have to be replaced with slashes and double slash after the colon. I'll try this and give an update.
It seems to be also an issue with MinGW compiler. The "bin" folder of the MinGW installation has to be added with os.add_dll_directory()
as well.
I found the information here and here.
The original problem is that MinGW has its own libstdc++-6.dll
which is dynamically linked to the compiled Simulink model. This makes it necessary to add the MinGW bin folder to the "dll search path". As an alternative the Simulink model has to be linked with static libs but I don't know how to do that.
I try to load a test model into pysimlink. I do a simple:
model = Model("testmodel", "./testmodel.zip", generator='MinGW Makefiles')
After compile step I get an error loading the generated module:
I set up a virtual environment in Python 3.9.9 with just the requirements needed for pysimlink. I also had to comment out the two lines for locking / unlocking as described in #17 .
The file "D:\Python\pySimlink\__pycache__\pysimlink\testmodel\build\out\library\testmodel_interface_c.cp39-win_amd64.pyd" is generated and is located in the given folder.