tundra@ux1.cso.uiuc.edu (John Kemp) (05/08/90)
Help! Does anybody know a way to DISABLE CHARACTER STRING LENGTH passing from Fortran to "C" subroutines? Fortran says this: call csub(s1,s2) C hears this: subroutine csub(s1,len1,s2,len2) Sun's don't behave this way, and we are porting some code originally written for a Sun. -------- john kemp ( ( )_ internet - kemp@uiatma.atmos.uiuc.edu ----- ( ( __) decnet - uiatmb::kemp --- univ of illinois (_ ( __) bitnet - {uunet,convex} -- dept of atmos sci .(____). !uiucuxc!uiatma!kemp - 105 s gregory ave ... phone - (217) 333-6881 - urbana, il 61801 ... fax - (217) 444-4393
tundra@ux1.cso.uiuc.edu (05/08/90)
>>>Does anybody know a way to DISABLE CHARACTER STRING LENGTH >>>passing from Fortran to "C" subroutines? Oops... Answered my own question... Apparently there is a Fortran compiler option to support the Fortran/"C" problem of passing character strings. If you compile with: fc +E3 Character descripter length parameters are moved to the end of the parameter list. Other people suggested passing integer arrays from Fortran, or using the "$ALIAS" compiler directive, both of which are good workable methods. Thanks for all who replied... -------- john kemp ( ( )_ internet - kemp@uiatma.atmos.uiuc.edu ----- ( ( __) decnet - uiatmb::kemp --- univ of illinois (_ ( __) bitnet - {uunet,convex} -- dept of atmos sci .(____). !uiucuxc!uiatma!kemp - 105 s gregory ave ... phone - (217) 333-6881 - urbana, il 61801 ... fax - (217) 444-4393
cunniff@hpfcso.HP.COM (Ross Cunniff) (05/08/90)
> Does anybody know a way to DISABLE CHARACTER STRING LENGTH > passing from Fortran to "C" subroutines? > Fortran says this: call csub(s1,s2) > C hears this: subroutine csub(s1,len1,s2,len2) I'm assuming you're on a Series 800, since the Series 300 acts more like the industry default in this case. Try the $HP9000 CHARS compiler directive, like this: program a.f: $HP9000 CHARS character*80 s1, s2 call csub( s1, s2 ) end program b.c: void csub( s1, s2, len1, len2 ) char *s1, *s2; int len1, len2; { } Ross Cunniff Hewlett-Packard Colorado Language Lab ...{ucbvax,hplabs}!hpfcla!cunniff cunniff%hpfcrt@hplabs.HP.COM