Hello Joris,
Thanks for the heads-up, I didn't know you could use the code-gen feature in this way.
It took me some time to set everything up but now it works properly and it's really fast! Thanks a lot!
Just in case someone else stumles upon this, this is the work flow I ended up with, using Visual Studio and Python on Windows.
There's probablier easier ways to do this, but I did it the first time and it works for me.
--------------------------------------------------------------------------------------------------
import subprocess
...
filename = ...
solver.generate_dependencies(
f"{filename}.c"
)
subprocess.call(["compile.bat", f"{filename}.c"])
...
solver = ca.nlpsol("mpc", "ipopt",
f"{filename}.dll", opts
)
--------------------------------------------------------------------------------------------------
Here, "compile.bat" is a batch script that sets up the environment to use the Visual Studio compilers and then compiles the file to a .dll
For me, it looks like this
--------------------------------------------------------------------------------------------------
set source_file=%1
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
"cl" "/LD" %source_file%
--------------------------------------------------------------------------------------------------
Hope this helps.
Best regards,
Steffen