home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:20296 comp.lang.fortran:5220
- Newsgroups: comp.lang.c,comp.lang.fortran
- Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!emory!sol.ctr.columbia.edu!still3.chem.columbia.edu!shenkin
- From: shenkin@still3.chem.columbia.edu (Peter Shenkin)
- Subject: Re: calling a Fortran subroutine from a C program
- References: <ig25.728061129@fg30> <1993Jan26.160622.24483@sol.ctr.columbia.edu> <1k49dbINNeij@gap.caltech.edu>
- Sender: nobody@ctr.columbia.edu
- Organization: Dept. of Chem, Columbia U, New York
- Date: Wed, 27 Jan 1993 17:08:39 GMT
- Message-ID: <1993Jan27.170839.4106@sol.ctr.columbia.edu>
- Distribution: na
- X-Posted-From: still3.chem.columbia.edu
- NNTP-Posting-Host: sol.ctr.columbia.edu
- Lines: 38
-
- In article <1k49dbINNeij@gap.caltech.edu> shepard@sampson.ccsf.caltech.edu (Ron Shepard) writes:
- >In article <1993Jan26.160622.24483@sol.ctr.columbia.edu> shenkin@still3.chem.columbia.edu (Peter Shenkin) writes:
- >>In article <ig25.728061129@fg30> ig25@fg30.rz.uni-karlsruhe.de (Thomas Koenig) writes:
- >>>An implementation might very well choose to start every character
- >>>variable on a word boundary, for speed reasons.
- >>>
- >>> CHARACTER*1 STRING(100)
- >>>
- >>>would then appear to C to be an array of ints, instead of chars.
- >>
- >>I think Cray in fact does this, while placing CHARACTER*1 scalars
- >>on byte boundaries.
- >>
- >> -P.
- >
- >Fortran requires some storage relations to hold between character
- >scalars and arrays.... In particular
- >
- > character*1 array(100)
- > character*100 scalar
- > equivalence (array, scalar)
- >
- >requires that array(i) and scalar(i:i) refer to the same character
- >storage location....
- >
- >The "array of ints" comment above is incorrect because of this
- >storage location requirement....
-
- If you read the above excerpts more carefully, you will see that I was
- referring only to CHARACTER *1 scalars vs. CHARACTER *1 arrays. I may
- still be wrong, but not, I believe, for the reason you gave.
-
- -P.
- --
- ************************f*u*cn*rd*ths*u*cn*gt*a*gd*jb************************
- Peter S. Shenkin, Box 768 Havemeyer Hall, Dept. of Chemistry, Columbia Univ.,
- New York, NY 10027; shenkin@still3.chem.columbia.edu; (212) 854-5143
- ***************** Watch this space for an important message ******************
-