From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4d1e35c40963653d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-12 04:18:01 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!feed1.news.rcn.net!rcn!not-for-mail From: Dan Nagle Newsgroups: comp.lang.ada Subject: Re: Trying to pass strings to Fortan routines Date: Sun, 12 Aug 2001 07:17:12 -0400 Organization: Purple Sage Computing Solutions, Inc. Message-ID: References: <3B763C53.18B8C606@mail.verizon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: UmFuZG9tSVZsPWk6+G7HT3hFbtjKkbqGMR6mGYmdZ8FWR7ouTCYfNydq1brtnJTC X-Complaints-To: abuse@rcn.com NNTP-Posting-Date: 12 Aug 2001 11:17:29 GMT X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:11814 Date: 2001-08-12T11:17:29+00:00 List-Id: Hello, Actually, the Fortran standard only says what a program has to be able to do with character arguments, not how to pass them. Popular varieties of implementation include -passing character, then length, for each character argument, -passing character with all the lengths at the end of the calling sequence (which you have described in your post), -and passing the address of a descriptor containing the address and length of the character argument. Note that the size of the length argument can vary, if you've got access to the documentation of the old Fortran compiler, you may be able to guess the size of the length arguments. Very few Fortran 77 compilers supported 4 billion character long character variables, and you don't show what the "strlen" macro? function? does... Good luck! -- Cheers! Dan Nagle Purple Sage Computing Solutions, Inc. On Sun, 12 Aug 2001 04:54:59 GMT, Jack Scheible wrote: >One of the promises of Ada was that one could use old libraries with the >Interfaces packages. It's not going so well. I have some old FORTRAN >libraries, and some of the routine accept CHARACTER*(*) arguments. When >FORTRAN makes a subprogram call with one or more "string" arguments, it >passes the lengths of those strings as arguments _after_ all the >declared arguments. I can get this to work with C. So if I call > > SUBROUTINE SUB( S1, S2 ) > CHARACTER*(*) S1, S2 > >with the C statement > > sub_( s1, s2, strlen(s1), strlen(s2) ); > >All is well. If I try the same thing in Ada (gnat), I get a Constraint >Error exception. > >Actually, I get a Constraint Error if I just pass a String and anything >else. > >Any ideas? > >Thanks. > >-jack