Integrating Fortran code in Julia -
i using gnu gfortran compiler (on cygwin) own module. example start compilation stage, address mangled names , call subroutine julia via ccall
. examples i've seen skip first 2 stages.
so imagine have following module in fortran 90 file named 'f90tojl.f90':
module m contains integer function five() 5 = 5 end function 5 end module m
this example here. compile gfortran follows create shared library:
gfortran -shared -o2 f90tojl.f90 -o -fpic f90tojl.so
and my, admittedly shaky, understanding reading julia docs suggest should able call function 5 so:
ccall( (:__m_mod_five, "f90tojl"), int, () )
it didn't work me. 'error compiling anonymous: not load module f90tojl...
. cares enlighten me? got sneaky sense i'm doing silly....
in official doc, emphasis on c. i'm aware of this c++. in r , python, momentum -- have cython , rcpp in mind -- seems c/c++. similar question, want sense of how easy interface julia fortran vs julia c/c++.
calling fortran , c same, documentation says. there far fewer examples because there far less code people want wrap, suppose. wrapping c super easy in julia, pleasant. not typically done speeding julia, r or python, more take advantage of quality code written.
julia's standard library great example of integrating fortran code, e.g. here julia wrapper arpark. outside of base
, glmnet written in fortran, , there julia wrapper (glmnet.jl).
i don't see how modern fortran distinction matters.
Comments
Post a Comment