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

IARGPTR

r_huhmann
Beginner
1,055 Views

Hello!

Version of ifort is 9.1. Iwould like to check the actual parameter list ina subroutine using IARGPTR(). Compiling results in'undefined reference to iargptr_'.Any suggestions?

Thanks

0 Kudos
5 Replies
Steven_L_Intel1
Employee
1,055 Views

I am nearly 100% certain that this is a documentation error - that routine was supported on DEC's OpenVMS but not on other platforms where the concept doesn't exist. We must have missed removing it from the manual at the move to Intel.

What specfically are you trying to do? Perhaps there's another way.

0 Kudos
r_huhmann
Beginner
1,055 Views

Thanks!

In fact I'm porting VMS software to linux. I found 'iargptr' aspart of asymbol in the binary file 'fortcom', so my hope was that the documentationwas just lacking some information.

The orignal source uses iargptr to find whichof theparameters are actually set. Then functionality depends on which parameters are set. Of course this could be solved with source modification but if you know some way similar to iargptr please let me know...

0 Kudos
Steven_L_Intel1
Employee
1,055 Views

Sorry, IARGPTR should not be listed in our documentation at all - it is a VMS only routine that depends on the VMS calling conventions. The writers have told me that they have removed this from the next version. You find it in the compiler binary because the same "front end" is shared (still!) with the VMS version and the string for the intrinsic name is there.

You cannot detect how many arguments were passed, since in Windows and Linux, unlike VMS, there is no argument count. The standard way of doing this in Fortran is to give the argument in the called routine the OPTIONAL attribute, make an explicit interface for that routine visible to the caller, and then use the PRESENT intrinsic to ask if the argument was passed.

If you know that the caller "omits" an argument by passing a zero by value, you can (except for assumed-shape arrays and character variables) test to see if %LOC(arg) is zero. This will be unreliable if the caller passes a shortened argument list, though.

0 Kudos
r_huhmann
Beginner
1,055 Views
Steve - thanks for your fast response. I will try to get through with PRESENT()
0 Kudos
Martin_C_
Beginner
1,055 Views

Though non-standard, I have used the following for using default I/O file names and overriding them with parameters:

INFILE = 'file.inp'
OUTFILE = 'file.out'
K = iargc()
if (K < 2) &
write(*,*) " >>>>> WARNING: Usage: its.x [inputfile] [outputfile]"
if (K <= 0) &
write(*,*) " defaulting input to: its.inp"
if (K <= 1) &
write(*,*) " defaulting output to: its.out"

do I = 0, K
call GETARG(I, BUFF)
if (I == 1) then
call GETARG(1, INFILE)
if (INFILE == "") then
call ABORTX("MYPROGRAM")
end if
end if
if (I == 2) then
call GETARG(2, OUTFILE)
if (OUTFILE == "") then
write(*,*) " >>>>> ERROR: CANNOT READ OUTPUT FILE NAME"
call ABORTX("MYPROGRAM")
end if
end if
end do

0 Kudos
Reply