Hey everyone!
At stdlib, we leverage free-form Fortran code extensively to optimize the performance of various BLAS (Basic Linear Algebra Subprograms) and LAPACK (Linear Algebra Package) routines. In response, Athan and I decided to document our methodology on How to Call Fortran Routines from JavaScript Using Node.js
.
We are happy to discuss on how we can leverage Fortran and enhance performance of web based applications.
9 Likes
Looks interesting, thanks. You write
It’s also worth mentioning that, because Fortran functions can only return scalar values and not, e.g., pointers to arrays, general best practice is to expose Fortran functions as subroutines, which are the equivalent of C functions returning void
and which allow passing pointers for storing output return values.
You may be correct that it is better to expose Fortran procedures as subroutines, but it is not true that “Fortran functions can only return scalar values”. Both intrinsic and user-written functions can return arrays.
User-written functions can return arbitrary data structures, can’t they? User-derived types and so forth?
Within a fortran program, fortran functions can return scalars, arrays, and pointers to intrinsic and user-defined types. However, this discussion is within the context of JavaScript interoperability. It seems that any time interoperability with other languages is involved, only a small subset of fortran features can be used.
okay, thanks for pointing! We’ll correct that