HP C/Fortran getarg question 
Author Message
 HP C/Fortran getarg question

The C/fortran program (main, Subroutine ftnmain) works correctly
on ibm rs6000 and does not work correctly on hpux 10.0 (new OS
installation). I wonder if anyone can see what makes the HP version
fail here. When I run the program on the HP, I get -1 for the
argument count and a blank character string for the first argument.

HP makefile:

FF= f77
CC = cc

CFLAG = -c -Aa
FFLAG = -c +ppu +U77

chkga: test.o chkfmt.o
        f77 +U77 -o chkga test.o chkfmt.o

chkfmt.o: chkfmt.F
        $(FF) $(FFLAG) chkfmt.F
test.o: test.c
        $(CC) $(CFLAG) test.c

----File chkfmt.F------
      Subroutine ftnmain

      Character*32 filename
      Integer ia, iargc
      External iargc, getarg

      ia = iargc()
      Write (*, *) ia
      Call getarg(1, filename)
      Write (*, '(a)') filename

      End

------EOF------

------File test.c----
#include <stdio.h>
#include <stdlib.h>
int main ( int argc, char *argv[])
{
  ftnmain_();
  return 0;

Quote:
}

-------EOF-------------

--
____________________________________________________________
Levent Kitis                          University of {*filter*}ia
Department of Mechanical, Aerospace, and Nuclear Engineering  
____________________________________________________________



Wed, 29 Sep 1999 03:00:00 GMT  
 HP C/Fortran getarg question

Quote:

> The C/Fortran program (main, Subroutine ftnmain) works correctly
> on ibm rs6000 and does not work correctly on hpux 10.0 (new OS
> installation). I wonder if anyone can see what makes the HP version
> fail here. When I run the program on the HP, I get -1 for the
> argument count and a blank character string for the first argument.

> HP makefile:

> FF= f77
> CC = cc

> CFLAG = -c -Aa
> FFLAG = -c +ppu +U77

> chkga: test.o chkfmt.o
>         f77 +U77 -o chkga test.o chkfmt.o

> chkfmt.o: chkfmt.F
>         $(FF) $(FFLAG) chkfmt.F
> test.o: test.c
>         $(CC) $(CFLAG) test.c

> ----File chkfmt.F------
>       Subroutine ftnmain

>       Character*32 filename
>       Integer ia, iargc
>       External iargc, getarg

>       ia = iargc()
>       Write (*, *) ia
>       Call getarg(1, filename)
>       Write (*, '(a)') filename

>       End

> ------EOF------

> ------File test.c----
> #include <stdio.h>
> #include <stdlib.h>
> int main ( int argc, char *argv[])
> {
>   ftnmain_();
>   return 0;
> }
> -------EOF-------------

> --
> ____________________________________________________________
> Levent Kitis                          University of {*filter*}ia
> Department of Mechanical, Aerospace, and Nuclear Engineering
> ____________________________________________________________

 Check the type for iarg and the 1st argument in getarg.  One (or both)
are probably INTEGER*2.  This may be the cause of your problem.


Wed, 29 Sep 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. HP-UX Fortran 90 getarg

2. FORTRAN getarg and iargc (HP-UX8.05)

3. GETARG and link problem on HP-UX f77

4. F77 getarg and iarc(HP-UX8.05) - Summary

5. HP fortran --> PC fortran question

6. getenv, getarg, iargc, system etc with intel fortran compiler

7. GETARG & IARGC in Intel Fortran

8. Using GETARG in Absoft Fortran under MPW

9. getarg/sleep/etime for Visual Fortran

10. Fortran on Linux (f2c): NARG() and GETARG()

11. MS Fortran PowerStation and "getarg" subroutine

12. HP Fortran question: precision of double-precision?

 

 
Powered by phpBB® Forum Software