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

Help with using module to initialize data

Wesley_G_
Beginner
679 Views
Hi,

I'm trying to recompile some code originally written by someone else about 5 or 6years ago. They use modules to initialize data and last time I compiled (about 3 years ago) everything worked fine. I'm on a new computer and using Version 11 for VF. When I run the program I find that none of the data in the module has been initialized....but on earlier compilers it seemed to work find. Is there some setting I'm missing?? Has there been a change in the way things should be set from say version 9 or so?? It's been too long and I don't know exactly which version I used to successfully compile it last time.

Thanks for the help/suggestions.......patience!!
Wes
0 Kudos
11 Replies
Steven_L_Intel1
Employee
679 Views
I think we need more details - such as some example source code. If you have variables with initialization in a module, you must make sure that the object file (.obj) from compiling the module gets linked in. This is especially an issue if you are using static libraries. Nothing in this area has changed.
0 Kudos
Wesley_G_
Beginner
679 Views
I think we need more details - such as some example source code. If you have variables with initialization in a module, you must make sure that the object file (.obj) from compiling the module gets linked in. This is especially an issue if you are using static libraries. Nothing in this area has changed.

I have attached the module I am referring to.

Wes
(Virus scan in progress ...)
0 Kudos
Steven_L_Intel1
Employee
679 Views
I've looked through the module source and don't see any variables that are initialized. Which variable is the problem and how are you determining that it is not initialized?
0 Kudos
Wesley_G_
Beginner
679 Views

I have attached the module I am referring to.

Wes

The ones I have noticed (because it causes a crash) are LUTERM_OUT which is set to 0 at line 295 I think and I_11which is set at line 38.

I think this guy did some very unconvential set up, but it is what I have to work with.

This is actually part of a FORTRAN lib that I am linking into a C++ program, using MS Visual C++ (2003 .net).

It has always worked prior to this, but now I am having trouble. When I launch the C++ program I debug it and set up a "watch". These variables show "Undefined variable".

W
0 Kudos
Steven_L_Intel1
Employee
679 Views
LUTERM_OUT and I_11 are not variables, they are named constants or PARAMETERs. You won't be able to view them in the debugger unless you rebuild the application specifying the option Fortran > Debugging > Information for PARAMETER constants > Yes.

However, as Fortran constants, they will not be visible to C++ code. How are these values being used and why do you think they are responsible for the error? What is the error message you see?
0 Kudos
Wesley_G_
Beginner
679 Views

The ones I have noticed (because it causes a crash) are LUTERM_OUT which is set to 0 at line 295 I think and I_11which is set at line 38.

I think this guy did some very unconvential set up, but it is what I have to work with.

This is actually part of a FORTRAN lib that I am linking into a C++ program, using MS Visual C++ (2003 .net).

It has always worked prior to this, but now I am having trouble. When I launch the C++ program I debug it and set up a "watch". These variables show "Undefined variable".

W
I'm getting a crash when I try to write to a file. The file unit number is LUTERM_OUT. I see what you mean about the parameters though. Let me look at something else and I'll get back to you.

Thanks for the re-direction.

W
0 Kudos
Steven_L_Intel1
Employee
679 Views
If you need more help, please show the complete error message and the WRITE statement involved.
0 Kudos
Wesley_G_
Beginner
679 Views
I'm getting a crash when I try to write to a file. The file unit number is LUTERM_OUT. I see what you mean about the parameters though. Let me look at something else and I'll get back to you.

Thanks for the re-direction.

W

I want to try something else. I know that this was working in a previous version (8 or 9) I think of VF. Is there a way I can download a previous version that old, re-install and see if I can get it working??

Thx,
W
0 Kudos
Steven_L_Intel1
Employee
679 Views
Yes you can - see here. You'll need to uninstall the newer version first.
0 Kudos
Wesley_G_
Beginner
679 Views
Yes you can - see here. You'll need to uninstall the newer version first.

when I follow that path I only see versions 10 and 11. Where are 8 & 9?? I know I had them at one point, but they do not show up on the list.

W
0 Kudos
Steven_L_Intel1
Employee
679 Views
I'm guessing that you did not follow the link in step 1 of the article I pointed to, which explains how to get the older version. That link would take you to How do I get an older version of an Intel Software Development Product?

This article explains how to get the older version.
0 Kudos
Reply