Thursday, July 2, 2020

Calling Fortran from Clojure

Calling compiled/native code from hosted/dynamic languages is always fun. Why not call Fortran from Clojure?

It turns out that Project Panama (used to call C from Java) makes this easy. But wait! Didn't you say calling Fortran from Clojure instead of C from Java? Yes, I did. Again, it turns out that calling Java from Clojure is easy, and making Fortran C-callable is also easy.

Check out my tiny clojure-fortran demo.

I think it would be interesting to get some kind of interop between the C structs (as in `ISO_Fortran_binding.h`) that describe Fortran arrays and Clojure.

Enjoy! Also, happy Canada day! Let's keep working toward a better world... who knows, maybe along the way you'll have to call Fortran from Clojure (but probably not).

No comments:

Post a Comment