- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
16 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i mean, it doesn't work with use dflib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
version 7.1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Change to USE IFLPORT
test.95 is not recognized as a Fortran source file type. Make sure the file name is test.f90.
Steve
test.95 is not recognized as a Fortran source file type. Make sure the file name is test.f90.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How are you running the program? You would have to run it from the command line with an argument to see anything.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i do run it from the command line!
C:...>test blabla
and i get:
1
C:...>
i really don't know
C:...>test blabla
and i get:
1
C:...>
i really don't know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your compile command is a bit strange. Try it this way:
ifl /4Yportlib test.f90
It works for me.
Steve
ifl /4Yportlib test.f90
It works for me.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks it does work now, but what does /4Yportlib means?
or where can i get some information please.
or where can i get some information please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
why it can be compiled properly with an access to all lib?
i'd like to know
i'd like to know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
got it.
thanks a lot
thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
/4Yportlib means to link against the Fortran Portability library - a collection of UNIX-compatibility routines.
Steve

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