Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29305 Discussions

View shared memory variables in the debugger

merik
Beginner
1,674 Views
I currently have a shared memory DLL that is created in C and attach to it in FORTRAN using the following method; however, when I try to see the value of the shared memory variable in the watch window, it is a bogus value: MAXFLOW = 5.6501789E-38 when it should be 0.2. Is there any way to see and modify shared memory variablesin the watch window?

REAL*4

& MAXFLOW ! MAXFLOW FOR PIPES [-]

&, TATAMB ! AMBIENT TEMPERATURE

LOGICAL*1

& HYDP_HYD_FRZ ! MODULE HYDP_HYD FREEZE FLAG

&, HYD_FRZ ! MODULE HYD FREEZE FLAG

CHARACTER*1

& DUM0100001(12),DUM0100002(5999997),DUM0100003(1)

COMMON /XRFTEST1 /

& DUM0100001,MAXFLOW,TATAMB,DUM0100002,HYD_FRZ,DUM0100003

&, HYDP_HYD_FRZ

!ms$attributes dllimport :: XRFTEST1

!ms$attributes C, alias : '_xrftest1' :: XRFTEST1


On the C side, xrftest1 is defined like this:

#pragma data_seg(".CDB")

__declspec (dllexport) char xrftest1[SEG1SIZE] = {""};

0 Kudos
14 Replies
Steven_L_Intel1
Employee
1,674 Views
Which Fortran compiler version are you using?
0 Kudos
merik
Beginner
1,674 Views
11.1, 10.1, 9.1
0 Kudos
merik
Beginner
1,674 Views
Any clue why this use to work in Compaq FORTRAN 6.6?

Merik
0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
1,674 Views

Merik,

Would it be possible to get a test case including command line options posted to this thread? The debuggers for Compaq Fortran 6.6 and the Intel Compiler would be different tools and the debug information has also evolved to support more recent releases.

A test case would help us to see what is going on. One thing to try is to back off of the optimization level to see if it makes a difference.

Wendy

Attaching or including files in a post

0 Kudos
merik
Beginner
1,674 Views
Hi Wendy,

I believe we have no optimization becuase we are running in Debug mode.I have uploaded a small project compiled with VS2005 and FORTRAN 9.1. You can convert the projectup to VS2008 and FORTRAN 11.1 if you wish. When you build the solution in Debug and run the progam "TestFortran", you can put a breakpoint in the TestFortran.for file at the print statement. Notice that you can see the internal variable value"MAXFLOWINTERNAL" but you cannot see the variable value in the shared memory "MAXFLOW". When you run the program on the command line, you see "This is the value of both maxflows 2.000000 6.000000".

Thanks
0 Kudos
merik
Beginner
1,674 Views
Actually, we tried this on 11.0 and it works (doesn't work) the same. We tried this on 11.1 and the shared memory is not seen at all by fortran. Is there a reason why? We can't even write to it or read it? Please help.
0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
1,674 Views
Thanks for the test case. I will work on reproducing it here and see if we can discover the cause.

Wendy
0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
1,674 Views
With Microsoft* VS 2008 and 11.1.060 I am able to see the correct value for MAXFLOW (2.0) and then am able to change it to another value through the watch window and then see that value print out. I am unable to open the project at all with Microsoft VS 2005 (no error, it just shows property files).

What version of Microsoft* VS 2005 and the 9.1 Intelcompilerare you using? (You can determine this with Help => About from inside Microsoft* VS 2005 and then paste the results to this thread).

My results for the case that works are below.

Wendy

Microsoft Visual Studio 2008
Version 9.0.21022.8 RTM
Microsoft .NET Framework
Version 3.5

Installed Edition: Professional

Microsoft Visual Basic 2008 91605-270-3152692-60284
Microsoft Visual Basic 2008

Microsoft Visual C# 2008 91605-270-3152692-60284
Microsoft Visual C# 2008

Microsoft Visual C++ 2008 91605-270-3152692-60284
Microsoft Visual C++ 2008

Microsoft Visual Studio 2008 Tools for Office 91605-270-3152692-60284
Microsoft Visual Studio 2008 Tools for Office

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB944899) KB944899
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/944899.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB945282) KB945282
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/945282.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946040) KB946040
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946040.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946308) KB946308
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946308.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946344) KB946344
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946344.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946581) KB946581
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946581.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947171) KB947171
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947171.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947173) KB947173
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947173.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947180) KB947180
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947180.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947540) KB947540
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947540.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947789) KB947789
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947789.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB948127) KB948127
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/948127.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB953256) KB953256
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/953256.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB971091) KB971091
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/971091.

Intel Visual Fortran Compiler Integration Package ID: w_cprof_p_11.1.060
Intel Visual Fortran Compiler Integration for Microsoft Visual Studio* 2008, 11.1.3470.2008, Copyright (C) 2002-2009 Intel Corporation
* Other names and brands may be claimed as the property of others.

Intel C++ Compiler Pro Package ID: w_cproc_p_11.1.054
Intel C++ Compiler Professional Edition Integration for Microsoft Visual Studio* 2008, Version 11.1.845.2008 , Copyright 2002-2009 Intel Corporation
* Other names and brands may be claimed as the property of others

This product includes software developed at The Apache Software Foundation (http://www.apache.org/).

Portions of this software were originally based on the following:
- software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
- software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
- the W3C consortium (http://www.w3c.org) ,
- the SAX project (http://www.saxproject.org)
- voluntary contributions made by Paul Eng on behalf of the Apache Software Foundation that were originally developed at iClick, Inc., software copyright (c) 1999.

This product includes updcrc macro, Satchell Evaluations and Chuck Forsberg. Copyright (C) 1986 Stephen Satchell.

This product includes software developed by the MX4J project (http://mx4j.sourceforge.net).

This product includes ICU 1.8.1 and later.Copyright (c) 1995-2006 International Business Machines Corporation and others.

Portions copyright (c) 1997-2007 Cypress Semiconductor Corporation. All rights reserved.

This product includes XORP. Copyright (c) 2001-2004 International Computer Science Institute

This product includes software from the book "Linux Device Drivers" by Alessandro Rubini and Jonathan Corbet, published by O'Reilly & Associates.

This product includes hashtab.c. Bob Jenkins, 1996.

Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB972221) KB972221
This update is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/972221.

0 Kudos
merik
Beginner
1,674 Views
Sorry, You are correct that the example works on 2008; however, I missed 1 important step which is to load the shared memory. I will try to send another example.
0 Kudos
merik
Beginner
1,674 Views

I may have a clue why it is not working. I have the following when I compile on 11.1:

sp0c0_orchidme_lib.lib(hydp_hyd.obj) : warning LNK4217: locally defined symbol __xrftest1 imported in function _CUSTOM_HYDP_HYD

In the example, I have sort of the same think:

TestFortran.obj : warning LNK4217: locally defined symbol __xrftest1 imported in function _MAIN__

This comes from the following line which seem to suggest that it cannot import the library:

!ms$attributes dllimport :: XRFTEST1

This warning doesNOT occur on version 11.0 and lower.

0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
1,674 Views

This warning is given when building a DLL that has a DLLIMPORT for a symbol that is defined in the DLL. Youll most often get this when there is a module that DLLEXPORTs a symbol and you USE that module while building the DLL. It is harmless and can be ignored. I get the warning also in VS2008 and I can see and modify the variable in the debugger. I will wait the new posting with additional content that will let me reproduce the problem on VS2005?

------

Wendy

Attaching or including files in a post

0 Kudos
merik
Beginner
1,674 Views
I think it is viewing a local variable. You can even see that it does not load the DLL when you run. I will try to get a better example.
0 Kudos
merik
Beginner
1,674 Views
We figured out the problem. It is related to having the underscore in the alias statement which gets rid of the warning and loads the DLL.

!ms$attributes C, alias : '_xrftest1' :: XRFTEST1

changes to

!ms$attributes C, alias : 'xrftest1' :: XRFTEST1


The question is why did this change from11.0 to 11.1 and is there any way to force the variables to work with underscore?
0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
1,674 Views
The behavior did not change and for the example you gave me with Microsoft Visual Studio 2008, I see the "_" (also not seeing the error). If you want to pursue this I need an example that demonstrates the missing "_" in 11.1 that I can open with Microsoft Visual Studio.

Thanks,

Wendy
0 Kudos
Reply