Skip to content

Software License Dongle for Fortran

Fortran binds through ISO_C_BINDING, which is standard Fortran 2003 and needs nothing vendor-specific: the same module works with gfortran, Intel and NAG.

use keynub_licdongle
integer(c_int32_t) :: handle, status
logical :: genuine

handle = keynub_open()                        ! > 0, or a negative status
if (handle < 0) error stop 'no KeyNub dongle attached'

status = keynub_verify_genuine(handle, genuine)
status = licdf_session_open(handle)
status = licdf_session_close(handle)
status = licdf_close(handle)Code language: Fortran (fortran)

Why Fortran codes are worth protecting

A Fortran solver is often the most valuable software an engineering company owns, and the least replaceable: decades of validation, published results depending on it, and physical correctness nobody wants to re-derive. It is also frequently licensed per seat or per cluster to organisations large enough that an honest licence count matters commercially.

The pattern that fits best here is the one Fortran already suggests: encrypt the material property tables, empirical coefficients or validated constants your solver reads at start-up. Those are the part a competitor cannot regenerate, they are already data rather than code, and without the dongle the solver has no physics to solve.

One module, and what to link

The binding is a single Fortran 2003 module built on iso_c_binding, plus helpers for the two things that are genuinely awkward from Fortran: NUL-terminated strings and caller-allocated output buffers. There is no build system of its own – you compile the module alongside your program and link one library.

That library is self-contained: the core, Mbed TLS and hidapi are compiled into it, so there is nothing else for a customer to install and no shared-library version to negotiate. Which matters for the codes Fortran still ships commercially – aerospace and structural analysis, CFD, computational physics, reservoir and process simulation – where the build environment is often frozen on purpose.

Code

Runnable sample: fortran/verify_and_read. Binding source: bindings/fortran. Both are Apache-2.0, in the public SDK repository; the prebuilt native libraries are in the repository’s natives/ folder, one per platform.

All supported languages · All industries · Buy a KeyNub · Ask us something