![发贴心情](skins/Default/topicface/face1.gif)
请将以下的程序编译为DLL文件,并用其他(我用的C#)语言调用一下,我自己做了一个,不能正常运行呀,实在不知道问题出在哪了?请哪位大神帮帮忙啊
subroutine A111()
!DEC$ ATTRIBUTES DLLEXPORT::A111
use IMSL
implicit none
external FCN
real, parameter :: ERRREL = 0.0001
integer, parameter :: N = 3
integer, parameter :: ITMAX = 100
real :: XGUESS(N) = (/ 0.0, 1.0, 2.0 /)
real X(N), FNORM
CALL NEQNF (FCN, ERRREL, N, ITMAX, XGUESS, X, FNORM)
open(unit=11,file='result.txt',status='replace')
write(11,*) x
write(*,*) x
close(11)
end subroutine
subroutine FCN (XA, F, N)
!DEC$ ATTRIBUTES DLLEXPORT::FCN
implicit none
integer N
real, target :: XA(N)
real F(N)
real, pointer :: x,y,z
! 在计算时使用x,y,z看起来比较清楚
x=>XA(1)
y=>XA(2)
z=>XA(3)
F(1) = x*x + y*y + z*z -3
F(2) = x*y + y*z + x*z -3
F(3) = exp(x) + exp(y) + exp(z) -3*exp(1.0)
return
end subroutine
subroutine A111()
!DEC$ ATTRIBUTES DLLEXPORT::A111
use IMSL
implicit none
external FCN
real, parameter :: ERRREL = 0.0001
integer, parameter :: N = 3
integer, parameter :: ITMAX = 100
real :: XGUESS(N) = (/ 0.0, 1.0, 2.0 /)
real X(N), FNORM
CALL NEQNF (FCN, ERRREL, N, ITMAX, XGUESS, X, FNORM)
open(unit=11,file='result.txt',status='replace')
write(11,*) x
write(*,*) x
close(11)
end subroutine
subroutine FCN (XA, F, N)
!DEC$ ATTRIBUTES DLLEXPORT::FCN
implicit none
integer N
real, target :: XA(N)
real F(N)
real, pointer :: x,y,z
! 在计算时使用x,y,z看起来比较清楚
x=>XA(1)
y=>XA(2)
z=>XA(3)
F(1) = x*x + y*y + z*z -3
F(2) = x*y + y*z + x*z -3
F(3) = exp(x) + exp(y) + exp(z) -3*exp(1.0)
return
end subroutine