- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See Solved: Re: C++ main cannot load Fortran DLL that has ALLOCATE statements - Intel Community , though in your case it is probably libmmd.dll.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you open an Intel oneAPI command prompt window (from the Start menu) and run your application from there, does it work? Did you build your DLL as a Release configuration?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page