Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29282 Discussions

Fortran DLL calling another Fortran DLL

charlesdayan
Beginner
642 Views
It should be simple:the first dll take the array and multiply its elements by 7 and the second one multiply by 10. (The real code is a bit more complex :) )
DLL 1:
Subroutine TIMES70(x)
implicit none
!DEC$ATTRIBUTES DLLEXPORT :: TIMES70
!DEC$ATTRIBUTES ALIAS : 'TIMES70' :: TIMES70
INTERFACE
SUBROUTINE TIMES10 (rarray)
!DEC$ATTRIBUTES DLLIMPORT :: TIMES10
REAL(8) rarray(3, 7)
END SUBROUTINE TIMES10
END INTERFACE
Real(8) , intent(inout) :: x
dimension x(3,7)
integer :: i
integer :: j

do j=1,7
do i=1,3
x(i,j)=x(i,j)*7
end do
end do
call TIMES10(x)
end subroutine
DLL 2:
Subroutine TIMES10(x10) !
implicit none
!DEC$ATTRIBUTES DLLEXPORT :: TIMES10
!DEC$ATTRIBUTES ALIAS : 'TIMES10' :: TIMES10
Real(8) , intent(inout) :: x10
dimension x10(3,7)
integer :: i
integer :: j

do j=1,7
do i=1,3
x10(i,j)=x10(i,j)*10
end do
end do
end subroutine
Do I need to put the .lib file of the second one into the project of the first? I've tried but didn't work ! I always get this error:
unresolved external symbol __imp_TIMES10
SOME SHORT EXAMPLE SHOULD BE APPRECIATE!!
0 Kudos
2 Replies
Steven_L_Intel1
Employee
642 Views
You do need to either add the .lib of the second DLL to the first project, or make the second a dependent project of the first. I don't spot any other issues.
0 Kudos
charlesdayan
Beginner
642 Views
Thanks!! Your hint worked. Ihadlinked the files in a wrong order!!
0 Kudos
Reply