- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am calling a fortran routine in a dll from c#. This routine calculate some properties from a system. If the system it's not possible, I get an error code and I try another parameters.
Well, that worked until today, but only in debug mode. Also, in release works as expected and the routine calculate something but in debug mode, the routine give always backan error code.
That's not big deal, if it works in release but still, it's very weird and disconcerting. It is possible that by debugging the results from the fortran routine are different than in release? Should I review the configuration of the compiler?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since you haven't given any information to narrow it down, all the usual considerations about debugging such differences are in play, not limited to uninitialized variables and array subscript violations, whether you set /fp:source, do you depend on implicit double precision evaluation of expressions, ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are completly right. I set the compiler option Warn for undeclared symbols to yes and...I got 13000 warnings. Many of them for the use of undeclared variables.
If I set the option Local Variable Storage to: All Variables SAVE (Q/Save) it seems to worl better but I don't know yet if it works completly.
I don't understand, why a programmer should use variables without declaration and initialisation...and I don't understand either, why a compiler should allow such a thing.
In any case, thank you to point me to the right direction :)
If I set the option Local Variable Storage to: All Variables SAVE (Q/Save) it seems to worl better but I don't know yet if it works completly.
I don't understand, why a programmer should use variables without declaration and initialisation...and I don't understand either, why a compiler should allow such a thing.
In any case, thank you to point me to the right direction :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using variables without declaration :
Fortran has what is known as "implicit typing"
If the programmer does not say what type a variable is (explicit typing)then the compiler chooses a type based on the variable name. If the name begins with one of the letters I,J,K,L,M, or N then it is assumed to be integer, otherwise it is assumed to be real.
Using variables without initialisation :
Some programmers have used compilers/linker/loader that automatically assigned an initial value to variables (0 for integers and 0.0 for real) And then they have continued to assume this practice with other compilers. Unfortunately not alldo this -though theremay bea flag to do so. (cf /Qzero in the help)
/Qsave-from the help :
"If a routine is invoked more than once, this option forces the local variables to retain their values from the last invocation. The save option ensures that the final results on the exit of the routine is saved on memory and can be reused at the next occurrence of that routine."
Read that carefully.It may or may not be what was intended to happen!
Les
Fortran has what is known as "implicit typing"
If the programmer does not say what type a variable is (explicit typing)then the compiler chooses a type based on the variable name. If the name begins with one of the letters I,J,K,L,M, or N then it is assumed to be integer, otherwise it is assumed to be real.
Using variables without initialisation :
Some programmers have used compilers/linker/loader that automatically assigned an initial value to variables (0 for integers and 0.0 for real) And then they have continued to assume this practice with other compilers. Unfortunately not alldo this -though theremay bea flag to do so. (cf /Qzero in the help)
/Qsave-from the help :
"If a routine is invoked more than once, this option forces the local variables to retain their values from the last invocation. The save option ensures that the final results on the exit of the routine is saved on memory and can be reused at the next occurrence of that routine."
Read that carefully.It may or may not be what was intended to happen!
Les

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page