getarg blank filled

getarg blank filled

hi,
i did what is written in the manual:
character::arg
integer::input,status
input=1
so,
call getarg(input,arg) // arg is blank filled
call getarg(input,arg,status) // compile but crash
with input=0 getarg(input,arg), arg is still blank filled
if i overload getarg or even define wrong types it still compile
i'm using the trial version with xp

thank

17 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Welcome to the forum!

Your declaration of arg is for only one character. Let me suggest you use:

character(80) :: arg

instead.

I also suggest that you add:

USE DFPORT

just after the PROGRAM, SUBROUTINE or FUNCTION statement. This will allow you to use the two and three argument versions of GETARG together.

Steve

Steve - Intel Developer Support

A couple of issues:

Since you don't specify which version of Fortran you're using, I think what is happening is that you cannot mix the 2 and 3 argument forms of getarg. This is likely to be one problem.

The second problem may be that getarg's two integer arguments, input and status, are 2-byte integers. I believe CVF, by default, uses 4-byte integers, so there may be an alignment problem.

The routine should compile if it's syntactically correct; unless the compiler has access to interface information, it cannot determine if the argument list in you code is the same as the argument list that getarg is expecting; call getarg(), call getarg(input, arg), and call getarg(arg, input) are all syntactically correct, so the compiler will be happy. After all, you may have written a routine named 'getarg' or be using one named 'getarg' from a 3d party library.

So my suggestions are:

Add the appropriate "USE" statement (USE DFLIB for CVF 6.6)

Explicity declare input and status to be integer(2).

Unless you've got one-byte command line arguments, declare arg to something generous, like character*256. Do not declare it as character arg(256). These are not equivalent!

Hand check your code to make sure the interfaces are right.

well, first, i know fortran for about few days.
i don't use cvf i use visual c++, so i don't have this dflib.
my application that work without the getarg, read a matrix from a file do some stuff on it(?syevd) and write eigenvalues.
i compile it with ... /link compiler_lib_path*.lib mkl_path*.lib
and yet to use ?syevd i don't need any USE statement and getarg is supposed to be an intrinstic function of fortran so, be properly compiled only with the lib path of the compiler.
??
thanks

i mean, it doesn't work with use dflib

Are you using Intel Fortran? Visual C++ doesn't compile Fortran programs. What version of Intel Fortran are you using? The current version 7.1 does have USE DFPORT.

Steve

Steve - Intel Developer Support

i use version 7.0.
if i compile it with : ifl test.f90 /link...
i have: module dfport not found
if i compile : ifl test.95 /link...
it says: error lnk1136 invalid or corrupted file

version 7.1

Change to USE IFLPORT

test.95 is not recognized as a Fortran source file type. Make sure the file name is test.f90.

Steve

Steve - Intel Developer Support

buffer is still blank.
this is the code:

program test
use iflport
integer*2 :: in,status
character*16 :: buffer
in=1
call getarg(in,buffer)
print *, in,buffer
end

compiled with:
ifl test.f90 /link C:IntelCompiler70IA32Lib*.lib

How are you running the program? You would have to run it from the command line with an argument to see anything.

Steve

Steve - Intel Developer Support

i do run it from the command line!
C:...>test blabla
and i get:
1

C:...>

i really don't know

Your compile command is a bit strange. Try it this way:

ifl /4Yportlib test.f90

It works for me.

Steve

Steve - Intel Developer Support

thanks it does work now, but what does /4Yportlib means?
or where can i get some information please.

why it can be compiled properly with an access to all lib?
i'd like to know

To be honest, I don't know what the linker does with the *.lib specification you gave. But I think what happened was that you got a C version of getarg that didn't know how to deal with Fortran character strings.

/4Yportlib means to link against the Fortran Portability library - a collection of UNIX-compatibility routines.

Steve

Steve - Intel Developer Support

got it.

thanks a lot

Leave a Comment

Please sign in to add a comment. Not a member? Join today