Is it possible to call a Fortran routine as a Scheme function? I could find nothing by searching the web.
相关问题
- CABS(x) function for complex(8)
- Generating powerset in one function, no explicit r
- What is fixed point?
- Upper bound of random number generator
- Finding number of lines of a data file using comma
相关文章
- Does gfortran take advantage of DO CONCURRENT?
- Does learning one Lisp help in learning the other?
- What is “3D syntax”?
- What is the definition of “natural recursion”?
- Fortran 90 - “Segmentation fault - invalid memory
- Reading records from a Fortran binary file in Pyth
- expand a dense matrix
- Unable to use f2py to link large PETSc/SLEPc Fortr
It all depends on your scheme platform. There is nothing regarding FFI (foreign function interface) in the standard per se, but every actual implementation has its own FFI mechanism (if any).
If you're using racket scheme, it appears there is a solution to do so : see http://wmfarr.blogspot.fr/2007/04/linear-algebra-in-plt-scheme.html
The answer depends on which implementation you use. Here is an example of writing bindings in Racket. The bindings are for CBLAS and LAPACK. The CBLAS library is C based and LAPACK is Fortran based. Therefore you can see both styles.
(Unfinished) Racket bindings for CBLAS and LAPACK
Is it possible? Technically, yes. Most modern Fortran compilers (e.g. ifort, gfortran) support the ISO C Interoperability feature set defined by the Fortran 2003 standard. Thus, it should be possible to write a C compatible API for the fortran libraries you need using the Fortran language. Once you have the C API in place, you should be able to use the standard C FFI provided by your scheme implementation. Of course, all of the usual caveats of calling a C function will also apply here.