I would like to call a .dll written in C into my Fortran code. I know that similar questions has been asked but the answers do not seem to work for me. I tried to read the file like follows:
use, intrinsic :: ISO_C_Binding
[...]
! ------------------------- including the controller-.dll -------------------------------
interface
subroutine Controller ( data, status, infile, out, msg) bind (C, NAME='Controller .dll')
use, intrinsic :: ISO_C_Binding
real(C_FLOAT), intent(inout) :: data(*)
integer(C_INT), intent(inout) :: status
character(kind=C_CHAR), intent(in) :: infile(*)
character(kind=C_CHAR), intent(in) :: out(*)
character(kind=C_CHAR), intent(inout) :: msg(*)
end subroutine controller
end interface
The syntax seems to be right since I do not get any error messages. But when I try to call the subroutine:
call Controller(ctrl_data,ctrl_status,ctrl_infile,ctrl_out,ctrl_msg)
I get the error message "error LNK2019: Reference to unlisted external symbol "Controller" in function "MAIN_STRUCTURE". main_structure.obj"
Furthermore, I am not entirely sure where to put the Contoller.dll. To make sure it can be found it is in the same folder as the source code as well as in the working repository.
I am using the ifort compiler and Visual Studio 2019.
I look forward to all responses. Thank you in advance.
David