Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29252 Discussions

How to Debug "step into" Fortran subroutine from C#

fbalderasintel
2,952 Views
I have an x64 C# app that successfully calls an x64 subroutine in a DLL. Yet I cant use Debug to
step into the Fortran. The two projects are in the same "solution". I tried moving all the Fortran compiler generated files, lib,pdb,exp etc into the same folder as the C# exe. C# has a property named "enable
unmanaged code debugging" but I think thats for within the its own module. Still I could swear I used to do this albeit that was all x32, so maybe thats the difference. Does anyone know some configuration that I need to do for the debugger to step into Fortran ?

0 Kudos
8 Replies
Steven_L_Intel1
Employee
2,952 Views
In the C# project properties, set Debugging > Enable unmanaged code debugging.
0 Kudos
fbalderasintel
2,952 Views
Yes I tried this but I get the error :The debugger does not support debugging managed code and native code at the same time on this platform". They are both x64. (MS VS 2008)
0 Kudos
fbalderasintel
2,952 Views

I found this note on a MSDN blog:

In Visual Studio 2008 and earlier releases, one of the key complaints is that the debugger doesn't allow you to debug 64-bit mixed mode (managed and native) applications. In fact, if you try to debug a 64-bit mixed mode application, you will see an error that is similar to the following.

---------------------------Microsoft Visual Studio---------------------------
Error while trying to run project: Unable to start program ''.The debugger does not support debugging managed and native code at the same time on this platform.
---------------------------OK ---------------------------


"The only workaround is to debug the managed portion of the application using the managed debugger and similarly, debug the native portion using the native debugger.

In Visual Studio 2010, we have removed this restriction such that you can use the Mixed Mode debugger for 64-bit applications. Hence, you will no longer see the above error message."

So it seems for x64 Mananged to Umanaged, there is no solution with VS 2008.

0 Kudos
Steven_L_Intel1
Employee
2,952 Views
Yep - that's a Microsoft restriction. I have read, but not yet verified for myself, that this is lifted in VS2010 if you use .NET Framework 4.0.

I haven't tried this, and perhaps it is not useful to you, but if you build a 32-bit DLL and set the C# project to target "X86" code, it might allow you to debug. I have found that on x64 I have to set .NET applications to target x64 or x86 if I'm using DLLs - "AnyCPU" won't let it run.
0 Kudos
fbalderasintel
2,952 Views
Yes, while our goal is all "x64" app, I think we can do some functional testing on x86 as a proof of concept. I might go ahead and get a trial version of VS2010 and pursue the all x64 test soon anyway.
0 Kudos
Steven_L_Intel1
Employee
2,952 Views
Note that Intel Visual Fortran does not yet support VS2010.
0 Kudos
fbalderasintel
2,952 Views
Ouch...

Is there any time frame for VS2010 support?
0 Kudos
Steven_L_Intel1
Employee
2,952 Views
Late this year.
0 Kudos
Reply