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

debugging sample project VB-Calls-Fortran.sln

Brian_Murphy
New Contributor II
4,528 Views
I have built this sample project, and it runs fine, but I'm having limited success with the debugger. The instructions say... To enable debugging of Fortran code called from Visual Basic, right click on project "VBCallsFortran" and then select Properties. In the left column, select Configuration Properties > Debugging. Check the box labeled "Enable unmanaged code debugging" VS 2012 doesn't have that option, but there is Enable Native Code Debugging. Checking that gets the debugger to step into and through the fortran code, but the values of arguments cannot be examined, although local variables can. Is there something else I need to do to enable this?
0 Kudos
43 Replies
FortranFan
Honored Contributor III
2,630 Views

Per Microsoft jargon, "unmanaged" and "native" appear to be synonymous.

Not sure why you're unable to examine values of arguments, I don't have that issue albeit with other .NET/Fortran projects.

0 Kudos
Brian_Murphy
New Contributor II
2,630 Views
I am using VS 2012 Update 4 and IVF Composer XE 2013. Are you saying that if you load this sample (from MixedLanguage.zip), change that debug setting, build it, and step into the fortran that you can examine the values of the arguments? One of the arguments is a 1d array DBL_IN. The "value" that the debugger gives me for this seems to be a memory address.
0 Kudos
FortranFan
Honored Contributor III
2,630 Views

Brian Murphy wrote:

I am using VS 2012 Update 4 and IVF Composer XE 2013. Are you saying that if you load this sample (from MixedLanguage.zip), change that debug setting, build it, and step into the fortran that you can examine the values of the arguments? One of the arguments is a 1d array DBL_IN. The "value" that the debugger gives me for this seems to be a memory address.

I don't have that issue albeit with other .NET/Fortran projects.

0 Kudos
Steven_L_Intel1
Employee
2,630 Views

Can you show a screen shot of what you are seeing? Here's what I see:

Capture.PNG

0 Kudos
Brian_Murphy
New Contributor II
2,630 Views

How do you paste a screen shot into a forum posting?  I've attached a gif file of my screen shot.

It turns out I was only partly right.  For the argument DBL_IN the debugger only gives me a memory address, but for DBL_OUT it gives me the individual element values.  I changed the declaration DBL_IN(0:3) to DBL_IN(4), and then the debugger would give me the element values.  I find it very strange that this would make any difference.

In your screen shot, I see a + sign next to DBL_IN, so that tells me you can see its element values, whereas I can't.  You'll see in my screen shot that I don't have the + sign on DBL_IN.

I've been playing around with variations where I add some more arguments to the subroutine, and weird things are happening.  Is the Visual Studio debugger case dependent with variable names?

 

0 Kudos
Steven_L_Intel1
Employee
2,630 Views

I embedded the screenshot by clicking on the picture icon to the right in the editor toolbar, selecting a file, clicking Upload, and then clicking Next as needed.

The screenshot you show tells me that you don't have the Fortran debugging support loaded, so you're getting C. Note that the datatypes show as "double" and not "REAL(8)". Try this - in VS, select Tools > Options > Debugging > Edit and Continue. If "Enable native Edit and Continue" is checked, uncheck it. This option, when enabled, blocks the Fortran debugger from loading in mixed-language applications.

0 Kudos
Brian_Murphy
New Contributor II
2,630 Views

468977

The attached file contains screen shots of all the option settings from Tools/Options/Debugging in case there is anything else that needs to be changed.

0 Kudos
Brian_Murphy
New Contributor II
2,630 Views

It looks like a bunch of my previous post got dropped somewhere.

I made the change you suggested to Tools/Options/Debugging, but it didn't make any difference.  That's why I sent screen shots of all the options.

0 Kudos
Steven_L_Intel1
Employee
2,630 Views

You showed only the General page, not the Edit and Continue page. But there can be other reasons the Fortran debugging support doesn't load. Sometimes an uninstall and reinstall of Fortran is needed.

0 Kudos
Brian_Murphy
New Contributor II
2,630 Views

That word file contained 4 pages of 7 total screen shots.  Edit and Continue is on the second page.  Let me know if they are not all there.

Is there anything important I need to know if I reinstall Intel Fortran?  I also have IMSL.

0 Kudos
Steven_L_Intel1
Employee
2,630 Views

Ah, somehow I missed that. The only thing I see different is that I have the initial "Enable Edit and Continue" box checked, though I doubt that matters here.

You can ignore IMSL - just uninstall Parallel Studio XE, delete the "Intel Fortran" folder under Microsoft Visual Studio 12.0, then reinstall. I hope this does the trick for you.

0 Kudos
Brian_Murphy
New Contributor II
2,630 Views

All righty.  It's uninstalling as I write this.

0 Kudos
Brian_Murphy
New Contributor II
2,630 Views
The uninstall has finished. I don't have a Microsoft Visual Studio 12.0 folder anywhere that I could find. In my C:\Users\Brian\Documents\Visual Studio 2012 folder there only two empty Intel Fortran folders in the templates area. I did also find and delete the following folder C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ProjectTemplatesCache\IntelFortran Now on to the reinstall.
0 Kudos
Brian_Murphy
New Contributor II
2,630 Views

The reinstall is finished, but it doesn't seem to have made any difference.  I'm still seeing C data types in the Locals window when stepping through the fortran sample code.

What else can I try?

0 Kudos
Steven_L_Intel1
Employee
2,630 Views

Oh, right - 11.0, not 12.0.

Do you get Fortran behavior debugging a regular Fortran program?

0 Kudos
Brian_Murphy
New Contributor II
2,630 Views
Yes, I do. I have a fortran program compiled with Intel Fortran into a DLL, which is called from a VB6 dll, which was called from an Excel VBA macro. VS 2012 steps through the fortran code very nicely, and the Locals window shows proper fortran data types. This scheme of chained DLL's works very well multidimensional arrays. This plays directly into why I'm seeking help with vb.net and fortran (to replace VB6 with vb.net). This debugging thing is just one of several problems I'm struggling with.
0 Kudos
Brian_Murphy
New Contributor II
2,630 Views

Is there anything else I can try?

If there isn't anything else, I have Visual Studio 2010 installed in a virtual machine.  Can I install my Intel Fortran XE 2013 onto that?

0 Kudos
Steven_L_Intel1
Employee
2,630 Views

Yes, that supports VS2010. I suppose you could try uninstalling both Fortran and VS and reinstalling. Oh, you have checked for VS2012 service packs, yes? It's up to Update 4. This might help.

0 Kudos
Brian_Murphy
New Contributor II
2,630 Views

I had installed VS 2012 Update 4, and when that didn't help, I uninstalled/installed Intel Fortran, and that didn't help.  That's where I am now.  I don't remember if I actually uninstalled VS 2012 before installing the update.  If you think redoing everything again might work some magic, I'll do it.

The attached SimpleFortranExcelDLL.zip contains a sln project that builds a very simple DLL, and calls it from an Excel macro.  When I run this, the Intel Fortran debugger displays fortran data types.

When I run the VB-Calls-Fortran sample project without modifying anything, the debugger won't step into fortran.  I then check the box for "Enable native code debugging", then it will step into fortran, but the debugger shows C data types when it's in the fortran code.

My problem seems to be with the debugger going from vb.net to fortran.  It's not making the switch cleanly.  When you run the VB-Calls-Fortran sample, do the data types in the Locals window change from C to Fortran when the debugger steps from vb to fortran?

0 Kudos
Steven_L_Intel1
Employee
2,526 Views

You can see in my post 5 that the datatypes show as Fortran types in the Fortran code. It never shows C types because there's no C code in that application.

0 Kudos
Reply