# Modern Fortran interface for NLopt

**URL:** <https://fortran-lang.discourse.group/t/modern-fortran-interface-for-nlopt/2685>\
**Category:** Help\
**Created:** [January 28, 2022, 4:04pm UTC](https://fortran-lang.discourse.group/t/modern-fortran-interface-for-nlopt/2685 "2022-01-28T16:04:56Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![awvwgk](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/awvwgk/32/154_2.png) [@awvwgk](https://fortran-lang.discourse.group/u/awvwgk)\
**Post date:** [January 29, 2022, 10:22am UTC](https://fortran-lang.discourse.group/t/modern-fortran-interface-for-nlopt/2685/5 "2022-01-29T10:22:10Z")

</div>

The native NLopt Fortran bindings are really only the bare minimum, _i.e._ they contain only the enumerator values, not even explicit interfaces, which makes them rather fragile to use.

As Emanuele @epagone pointed out, I already went through all the work to create interfaces to the actual C API of NLopt and wrap them nicely in a derived type to make the overall user experience more pleasant (announced in [NLopt Fortran bindings](https://fortran-lang.discourse.group/t/nlopt-fortran-bindings/1686)). I also put some work into making the Fortran bindings compatible with all NLopt versions since 2.0.0, because not all package managers ship the latest version. Feedback and contributions are of course very welcome.

If you want to see an actual application of the Fortran bindings to NLopt, I recently pushed [dftd4/dftd4-fit](https://github.com/dftd4/dftd4-fit), which glues together a couple of fpm projects to a small command line optimization driver.

---

_[View the full topic](https://fortran-lang.discourse.group/t/modern-fortran-interface-for-nlopt/2685)._
