# CasADiNLPModels.jl: an interface for CasADi via loading code generated functions

**URL:** <https://discourse.julialang.org/t/casadinlpmodels-jl-an-interface-for-casadi-via-loading-code-generated-functions/133925>\
**Category:** Optimization (Mathematical)\
**Tags:** package, autodiff, modelling\
**Created:** [November 17, 2025, 8:07am UTC](https://discourse.julialang.org/t/casadinlpmodels-jl-an-interface-for-casadi-via-loading-code-generated-functions/133925 "2025-11-17T08:07:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apozharski](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@apozharski](https://discourse.julialang.org/u/apozharski)\
**Post date:** [November 17, 2025, 8:07am UTC](https://discourse.julialang.org/t/casadinlpmodels-jl-an-interface-for-casadi-via-loading-code-generated-functions/133925/1 "2025-11-17T08:07:20Z")

</div>

We (@frapac, @apozharski, and Armin Nurkanović) have released a small new package for easily interfacing NLPs modeled in CasADi with the `NLPModels.jl` ecosystem. The package implements loading of CasÄDi code generated functions from compiled binaries. This is used to load NLPs from such binaries and wrap them in an `CasADiNLPModel` which can then be solved using any of the suite of Julia solvers which handle `AbstractNlpModels`.

The workflow to use this package can be quickly summarized as:

1. Model your problem using CasADi, using whatever interface you would like.
2. Code generate the C code for the required functions (see [the README on github](https://github.com/apozharski/CasADiNLPModels.jl)), and compile them into a shared library using your favorite C compiler.
3. Create a JSON file with the required numerical data.
4. Load the NLP into Julia using the `CasADiNLPModel` constructor.
5. Solve using your favorite Julia interfaced NLP solver.

The package is fairly basically featured at the moment so if you find any bugs or have any feature requests, feel free to [submit an issue](https://github.com/apozharski/CasADiNLPModels.jl/issues).

---

<div class="post-metadata">

**Author:** ![amontoison](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amontoison/32/218741_2.png) [@amontoison](https://discourse.julialang.org/u/amontoison)\
**Post date:** [November 19, 2025, 11:35am UTC](https://discourse.julialang.org/t/casadinlpmodels-jl-an-interface-for-casadi-via-loading-code-generated-functions/133925/3 "2025-11-19T11:35:02Z")

</div>

Excellent work @apozharski !  
Note that on Windows, you can directly use `gcc` / `gfortran` compilers as an artifact on Windows.

It is what we do `CUTEst.jl` and the user doesn’t need to know that we dynamically compile / generate shared libraries and do some dlsym on the symbols.
