I'm trying to get Julia to run a Fortran file on Windows 10, and Julia says
that it can't open the library. Libdl.dlopen also fails to open the file.
I've tried adding the current path to LOAD_PATH but still get the same
error.
For a test case, I'm running the following module:
module hello_module
use iso_c_binding
implicit none
contains
subroutine hello() bind(C,name="hello")
!DEC$ ATTRIBUTES DLLEXPORT :: hello
write(*,'(A)') "Hello World!!!"
end subroutine hello
end module hello_module
I'm compiling it in Cygwin64 (I'm on a 64bit Windows 10 machine) using
gfortran with:
gfortran -shared -o2 -fPIC Hello.f90 -o HelloWorld.dll
I get a warning that -fPIC is ignored, but the file compiles and creates
HelloWorld.dll
In Julia, I call the library using
ccall((:hello,"HelloWorld.dll"),Void,())
which results in:
ERROR: could not load library "HelloWorld.dll"
The specified module could not be found.
in dlopen at libdl.jl:36 (repeats 2 times)
in dlopen at deprecated.jl:32
Just trying to open the module using Libdl.dlopen("HelloWorld.dll") gives
the same error.
Note that I moved the .dll file to a new location after compiling it since
the goal is to put the code in a single folder that other users can put on
their windows machines and run.
How do I get Julia to open and run the code?
Thanks,
Kaela