- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Following subroutine is adapted from Numerical Recipe.
SUBROUTINE LOCATE(XX,N,X,J)
DIMENSION XX(N)
JL=0
JU=N+1
10 IF(JU-JL.GT.1)THEN
JM=(JU+JL)/2
IF((XX(N).GT.XX(1)).EQV.(X.GT.XX(JM)))THEN
JL=JM
ELSE
JU=JM
ENDIF
GO TO 10
ENDIF
J=JL
RETURN
END
In fact, I create a static library to collect all of the subroutines/functions in Numerrical Recipe.
then I call this subroutine. When I run it and debug it,
SUBROUTINE LOCATE(XX,N,X,J)
here ^N=4, as debugger shows
DIMENSION XX(N)
JL=0
JU=N+1 <== here JU=0
Why?
......
J=JL <== J= huge integer number
I don't have this problem when I use CVF.
thanks a million.
Mike
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What does "default integer size" mean? Do you mean J, JU are not declared, so maybe have some unexpected values?
I have one LibAC.lib, whose Project->Property settings are:
Fortran->Command Line
/nologo /Zi /Od /gen-interfaces /warn:interfaces /module:"Debug" /object:"Debug" /traceback /check:bounds /libs:static /threads /dbglibs /c
Librarian->command line shows:
/OUT:"Debug/LibAC.lib" /NOLOGO
====================================
Numerical Recipe library (recipef.lib):
Fortran->Command Line
/nologo /Zi /Od /include:"Debug/" /Qsave /iface:cvf /module:"Debug/" /object:"Debug/" /traceback /check:bounds /libs:static /threads /dbglibs /c
Librarian->command line shows:
/OUT:"Debug/recipef.lib" /NOLOGO
==================================
The client code settings are:
Fortran->Command Line
/nologo /Zi /Od /include:"D:26SLibACLibACDebug" /gen-interfaces /warn:interfaces /module:"Debug" /object:"Debug" /traceback /check:bounds /libs:static /threads /dbglibs /c
Linker->Command Line
/OUT:"Debugsdue2AE.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"D:26Ssdue2AEdebugsdue2ae.exe.intermediate.manifest" /DEBUG /PDB:"D:26Ssdue2AEdebugsdue2ae.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"D:26Ssdue2AEdebugsdue2ae.lib" D:26SLibACLibACDebugLibAC.lib D:26Srecipef.lib
In fact, LibAC.lib callLOCATE (in recipef.lib) and then client code uses LibAC.lib.
Does recipef.lib used by LibAC.lib necessary to be linked in the Settings of LibAC.lib?
What is "/Qsave /iface:cvf"? It seems different from compiler's settings of LibAC.lib and client code.
It seems recipef.lib are converted from CVF's project and I do have an old recipef project.
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Subroutine LOCATE are in fortran 77 fixed format.
The caller code is in free format. Does it matter?
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
quote "What does "default integer size" mean?"
In VS IDE Project-Properties->Fortran->Data there are three settings
Default Integer KIND, Default Real KIND and Default Double Precision KIND
Theyapply to the project as a whole but are over-ridden by what is in the code. For example if in the code you have
INTEGER K
then it will take the kind of the project default.
But INTEGER(2) K will be a two byte integer always.
Quote "What is /iface:cvf"
This is very important and I suggest you read the manual about "Calling Convention" cvf is the convention used by the Compaq Fortran compiler. From the docs :
"By default, /iface:cvf passes arguments by reference. /iface:cvf sets the /iface:mixed_str_len_arg option. This causes CHARACTER variables to be passed as address/length pairs."
It is important to be consistent especially in mixed language programs.
Quote " What is /Qsave?"
From the docs :
"This option saves all variables in static allocation (ie not on the run time stack)except local variables within a recursive routine and variables declared as AUTOMATIC."
Italics mine.
Les
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page