- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
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,
John
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are the Fortran and C runtime DLL's on your system path?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I verified them by comparing them to the working install.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I verified them by comparing them to the working install.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
using System.Runtime.InteropServices;
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?
Regards,
Greg T.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using the VB.NET equivalent, but yes, I have tried both the DllImport method and the Declare method. Both dll call types work, just not on my machine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using the VB.NET equivalent, but yes, I have tried both the DllImport method and the Declare method. Both dll call types work, just not on my machine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
John N wrote:
.. Both dll call types work, just not on my machine.
@John N,
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?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page