Hi all.
I am new to Frotran, need some precise calculations, writing a fortran dll, to be called from C#. Following Fortran function compiles (Intel Fortran compiler, Microsoft Visual studio 2022) without error or warning:
链接已复制
See Solved: Re: C++ main cannot load Fortran DLL that has ALLOCATE statements - Intel Community , though in your case it is probably libmmd.dll.
function getSin( instance ) result(output)
! Dec$ ATTRIBUTES DLLEXPORT, C :: getSin
!Dec$ ATTRIBUTES REFERENCE :: instance
type(struct_angle), intent(in) :: instance
real*16 :: output
real*16 :: angle16
real*16 :: sine16
angle16 = instance%value_
sine16 = QSIN(angle16)
output = angle16
end function getSin
It helps make it easy to read if you use the formatting tool on the tool bar it looks like </>.
In reality, there is almost a one to one correspondence between Fortran and C# in terms of functionality, so making a DLL in Fortran unless you are doing heavy duty calculations is a waste of time, unless it is a learning exercise.
As an example the Numerical Analysis in Fortran FFT translated into C# yields the same loop time on 16384 data points as Fortran version, and the version on RPi runs in 7 seconds.
Of course one can use the MKL version, which is faster.
Mixing languages is painful. I was running some numerically intensive Fortran stuff the other day, the loop time for each set was about 1.5 seconds on a core I7, the machine started some services and the loop time went to 5 seconds, it took me a while to find the blasted services and turn them off.
Hi Steve,
thanks for your prompt reaction. I have been out this week, just home again.
Adding oneAPI\2025.0\bin to the Path variable does not solve my problem.
Any idea what more I can try?
