- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I am porting a Fortran codeset whichused to be built/run on Linux/Unix environment. Now, I have to build the same codeset; using Fortran 10.1 in Windows 32 and 64 bit environment. This code uses CALL SYSTEM(COMMAND) tosend a command to the system. It appears that windows library does not know about any SYSTEM function being called. So, I am getting compilation error while linking to the exe.
I was wondering; If you are aware of any library which I need to include to get this functionality/compilation working in Windows as well as in Linux environments.
Thanks and Regards
Sk
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some comments which, if taken into consideration, would make diagnosing problems easier:
"windows library does not know about any SYSTEM function": it would help to know which windows library one should be concerned with -- my system has 1565 DLLs in the windows\system32 directory.
"I am getting compilation error while linking to the exe": please do not confuse compilation time errors and linker reported errors.
Thanks.
- 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
Try using it as a function, instead of a subroutine, e.g.:
[fortran]USE IFPORT ... res = SYSTEM(command)[/fortran]The function is included in the IFPORT module (so the "USE IFPORT" line is necessary). The same module also includes SYSTEMQQ, which does exactly the same, but has a different scheme for the errors returned (e.g., ERR$2BIG instead of E2BIG).
GCC/Gfortran, Sun Fortran and PGI Fortran also support the function version of SYSTEM, so making the change probably won't break compatibility with the Linux/Unix environment in which your codeset used to be built.
Keep in mind that ifort's SYSTEM function executes the command in a new environment. If you need to execute within the same environment, use RUNQQ instead ---see ifort's documentation for details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So, I added 'ifport.f90' as a new module with the following -
SUBROUTINE SYSTEM()
INCLUDE 'hdb.inc'
INCLUDE 'db_appmon.inc'
END SUBROUTINE SYSTEM.
Now, I am getting the following errors; when I try to compile thecode containing CALL SYSTEM(COMMAND).I am sorry, Iam unable to figure it out.
.\ifport.f90(2) : Error: Illegal character in statement label field
.\ifport.f90(2) : Error: Illegal character in statement label field
.\ifport.f90(2) : Error: Illegal character in statement label field
.\ifport.f90(2) : Error: Illegal character in statement label field
.\ifport.f90(2) : Error: Illegal character in statement label field
.\ifport.f90(2) : Error: First statement in file must not be continued
.\ifport.f90(3) : Error: Illegal character in statement label field
.\ifport.f90(3) : Error: Illegal character in statement label field
.\ifport.f90(3) : Error: Illegal character in statement label field
.\ifport.f90(3) : Error: Illegal character in statement label field
.\ifport.f90(3) : Error: Illegal character in statement label field
.\ifport.f90(4) : Error: Illegal character in statement label field
.\ifport.f90(4) : Error: Illegal character in statement label field
.\ifport.f90(4) : Error: Illegal character in statement label field
.\ifport.f90(4) : Error: Illegal character in statement label field
.\ifport.f90(4) : Error: Illegal character in statement label field
.\ifport.f90(4) : Error: Invalid character_kind_parameter. No underscore
.\ifport.f90(5) : Error: Illegal character in statement label field
.\ifport.f90(5) : Error: Illegal character in statement label field
.\ifport.f90(5) : Error: Illegal character in statement label field
.\ifport.f90(5) : Error: Illegal character in statement label field
.\ifport.f90(5) : Error: Invalid character_kind_parameter. No underscore
.\ifport.f90(3) : Error: Syntax error, found IDENTIFIER 'E' when expecting one of: =
Error: The attributes of this name conflict with those made accessible by a USE statement. [STAT]
Error: The CALL statement is invoking a function subprogram as a subroutine. [SYSTEM]
Error: The attributes of this name conflict with those made accessible by a USE statement. [STAT]
Error: The attributes of this name conflict with those made accessible by a USE statement. [STAT]
compilation aborted for D:\AREV\habsrc9B\habuser\special\appmon\appmon_monitor.for (code 1)
Please help.... Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
USE ifport
in your source code.
Your addition of a conflicting version of ifport.f90 causes some of the errors. Other errors appear to be caused by attempting to compile free form source code as fixed form, as would happen by default if you name a free source file with .f .F .for or the like, or if you specified a fixed source format option.
You are entitled to put in your own subroutine named SYSTEM but that will block use of the one from the provided library, in that part of your own code, even though your usage doesn't match the one supported by the library SYSTEM function.
You were already shown an example of how the library SYSTEM function works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
USE ifport
in your source code.
Your addition of a conflicting version of ifport.f90 causes some of the errors. Other errors appear to be caused by attempting to compile free form source code as fixed form, as would happen by default if you name a free source file with .f .F .for or the like, or if you specified a fixed source format option.
You are entitled to put in your own subroutine named SYSTEM but that will block use of the one from the provided library, in that part of your own code, even though your usage doesn't match the one supported by the library SYSTEM function.
You were already shown an example of how the library SYSTEM function works.
Regards
Shailesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Shailesh,
I met the same problem as you met before. Could you please let me know how to solve problem?
Thanks,
Wei

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