I'm using CVF and I'm trying to create Fortran dll and call some functions from it from another Fortran program. Here is my code for the program inside the DLL:
subroutine abc(a,b,c)
!DEC$ ATTRIBUTES DLLEXPORT :: abc
implicit none
integer, intent(in) :: a,b
integer, intent(out) :: c
real*8 pi
complex*16 ci
pi=3.1415D0
ci=dcmplx(0.D0,1.D0)
c=a+b-10*int(cdabs(cdexp(pi*ci))
return
end subroutine abc
And the code for the EXE is:
program main
!DEC$ attributes dllimport :: abc
implicit none
integer a,b,c
write(*,*) 'Enter a'
read(*,*) a
write(*,*) 'Enter b'
read(*,*) b
call abc(a,b,c)
write(*,*) a,'+',b,'- 10*int(cdabs(cdexp(pi*ci))','=',c
read(*,*)
stop
end program main
I've added lib-file of the dll in the project settings. The problem occurs when dll subroutine perform some operations with complex*16 numbers and EXE program throws critical message that it unabled to locate DFORRTD.dll. In simple variant, without any complex-number operations everything works very well. I've tried just about everything I can think of I can do with it.
There is probably something incredibly stupid that I'm missing, but I cannot figure out what it is. Each program was coded in it's own little project folder. When I tried importing the projects into the same workspace, the DLL would compile properly but the EXE would not. Any help would be greatly appreciated.
subroutine abc(a,b,c)
!DEC$ ATTRIBUTES DLLEXPORT :: abc
implicit none
integer, intent(in) :: a,b
integer, intent(out) :: c
real*8 pi
complex*16 ci
pi=3.1415D0
ci=dcmplx(0.D0,1.D0)
c=a+b-10*int(cdabs(cdexp(pi*ci))
return
end subroutine abc
And the code for the EXE is:
program main
!DEC$ attributes dllimport :: abc
implicit none
integer a,b,c
write(*,*) 'Enter a'
read(*,*) a
write(*,*) 'Enter b'
read(*,*) b
call abc(a,b,c)
write(*,*) a,'+',b,'- 10*int(cdabs(cdexp(pi*ci))','=',c
read(*,*)
stop
end program main
I've added lib-file of the dll in the project settings. The problem occurs when dll subroutine perform some operations with complex*16 numbers and EXE program throws critical message that it unabled to locate DFORRTD.dll. In simple variant, without any complex-number operations everything works very well. I've tried just about everything I can think of I can do with it.
There is probably something incredibly stupid that I'm missing, but I cannot figure out what it is. Each program was coded in it's own little project folder. When I tried importing the projects into the same workspace, the DLL would compile properly but the EXE would not. Any help would be greatly appreciated.