I am using the GNU gfortran compiler (on Cygwin) for my own module. A good example will hopefully start from the compilation stage, address mangled names and call the subroutine from Julia via ccall. Most examples I've seen skip the first two stages.
So imagine that I have the following module in Fortran 90 file named 'f90tojl.f90':
module m
contains
integer function five()
five = 5
end function five
end module m
This example is from here. I compile it with gfortran as follows to create a shared library:
gfortran -shared -O2 f90tojl.f90 -o -fPIC f90tojl.so
And my, admittedly shaky, understanding from reading the Julia docs suggest that I should be able to call the function five like so:
ccall( (:__m_MOD_five, "f90tojl"), Int, () )
It didn't work for me. I get 'error compiling anonymous: could not load module f90tojl.... Anyone cares to enlighten me? I got the sneaky sense I'm doing something silly....
In the official doc, the emphasis is on C. I'm also aware of this for C++. In R and Python, the momentum -- I have Cython and Rcpp in mind -- seems to be C/C++. Similar to this question, I want to get a sense of how easy it is to interface Julia with Fortran vs Julia with C/C++.
"f90tojl"to"f90tojl.so"works for me.