I just installed Parallel Studio XE for Windows. I have tried to reference multiple Fortran DLLs from .NET. The call doesn't toss any errors but the Fortran DLL doesn't run. This morning, I took a copy of a test project and had a colleague run the same project and it worked successfully for him but it does nothing for me. With one sample program I get an unable to load dll error. I'm linking the dll as an existing item (add by link). Most just act like they will work and do nothing.
I'm able to run the same code by running it as a fortran exe instead on my machine. We are both running VS 2015 enterprise and have the latest versions of Parallel Studio for Windows. The only difference is I'm running Windows 10 and he is running Windows 7. What could I be missing from a configuration standpoint to cause this issue. Or is it a setup issue? Or just Windows 10?
Thanks in advance for the help,
Your approach with .NET calling Fortran DLLs may be similar to mine. Are you using C# or maybe VB? I have a C# front end exe that calls Fortran DLLs. I've had success by copying the Fortran DLLs into the C# projects /bin/x64/Debug folder, then running the C# exe from Visual Studio or directly at the exe.
In the C# class that calls the Fortran routines I have added syntax to identify the DLL name and subroutine name, and add the "InteropServices" class:
And in the C# method I also define each Fortran routine as a static external method with the DllImport attribute to name the DLL to help the exe locate it. I have found that I can omit the ".dll" extension for the project name in DllImport, such as myFortProj.dll identified as "myFortProj" with subroutine "myFortSub":
[DllImport("myFortProj")] static extern void myFortSub(ref int value1, double array2);
And then later in the C# method the "myFortSub" is called. Is this anything like what you are trying to do?
John N wrote:
.. Both dll call types work, just not on my machine.
Have you checked the dependencies of the DLL(s) in question using a tool such as Dependency Walker and confirmed the files are all present on your system?