How to debug a Fortran application calling a managed DLL.

Currently Intel® Fortran Compiler for Windows projects created within Microsoft Visual Studio* just support "Native Only" option in "Debugger Type" setting (see Figure 1). If your project is a Fortran main program calling a managed DLL you will not be able to debug your Fortran code into managed code source line starting from your application.

 

Figure 1

 

Here is a workaround for this limitation:

1. Set your Visual Studio environment as written under "Debugging mixed language programs with Fortran does not work" at https://software.intel.com/en-us/articles/intel-visual-fortran-compiler-160-for-windows-release-notes-for-intel-parallel-studio-xe#known_issues, and then rebuild the Fortran application and the managed DLL projects.

 

2. Set the managed DLL project as the startup project of the VS solution by selecting it in the "Solution Explorer" windows, right-clicking and choosing "Set as Startup Project"  (see Figure 2).

 

Figure 2

 

3. Open the project properties page of the managed DLL project and go to "Debug" page, select "Start external program" for "Start Action" field, and then input the full path to your Fortran application executable file generated by in step 1 (see Figure 3).

 

Figure 3

 

4. Toggle break points at your Fortran application and/or managed DLL source code lines where you want to break by key "F9".

 

5. Start debugging by key "F5".

 

Now you can debug your Fortran/Managed DLL mixed language code by stepping through source code lines.

 

有关编译器优化的更完整信息,请参阅优化通知