Created attachment 16467 [details]
zip file containing the VS2015 project, debug notes, and PDF file showing results
When running the attached small C# project under x64 Mono (220.127.116.11) on Windows (Win7 Pro) from Visual Studio 2015 a DllNotFoundException occurs when calling a Fortran dynamic library (using "dllimport" for P/Invoke). The project works correctly under x86 Mono, and correctly under .NET for both x86 and x64 on Windows from VS2015. I copy the executable to Linux (Red Hat 6.8) and it runs correctly under x64 (calls a native Fortran shared object).
I am using the MonoHelper add-in to VS2015 to run Xbuild to get the C# "CallDll.exe" executable. I also ran the exe from the Mono command line using "mono --debug CallDll.exe > mono_debug.txt" to check the file path being searched for the "fortlog.dll" file. The debug output shows that it is searching in the correct directory but does not find the "fortlog.dll". For this simple reproducing case I am not passing any arguments to the Fortran routine, just testing the "dllimport" syntax (for P/Invoke) from C# to Fortran.
The attached zip file and attached PDF file show the expected output and error output. The "CallDll" project has a single form with a button and text box. The expected result when clicking the button is to increment count and get the message "called the Fortran shared library..." and for the Fortran routine to write text and list of numbers to the "writelog.log" text file. The error output for x64 Mono on Windows is the DllNotFoundException, which gets trapped in the try-catch block.
The zip file contains the VS2015 project with the exe and dll files in the x64 ad x86 sub folders along with the "writelog.log" text file in the x86 folder, and the "mono_debug.txt" output in the x64 folder.
Since this test case (and other C# calling Fortran under Mono cases) work except under x64 Mono on Windows, we can run the x64 case on Linux, but it would be convenient to be able to test x64 on Mono on Windows from VS2015.
Let me know if additional information would help.
Thanks for your help.
Please try with the most recent release of Mono (4.6.x). The state of Mono on Windows x64 has improved immensely the last couple of months.
Thank you for the notice that a new Mono update is available. I'll give it a try.
Did you have a chance to try latest Mono? If so, did it fix your bug? Thank you
Thanks for the update. I have not yet had a chance to install mono on Windows to check if it works with x64. That is still on my to do list when time permits.
Were you able to used the attached small program on Windows x64?