HP3000-L Archives

September 2000, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Emerson, Tom # El Monte" <[log in to unmask]>
Reply To:
Emerson, Tom # El Monte
Date:
Wed, 20 Sep 2000 14:48:38 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (67 lines)
Actually, wouldn't that be the other way around?  "strings" in C aren't a
real structure, just a structure-by-convention (and the convention is "null
terminated")  Fortran might (actually, does -- see below) have the
requirement to have the length passed as part of the "string structure"  (I
know this is true of Pascal, and I'm thinking Fortran may be more
"fixed-length-string" oriented, so "length" isn't really a concern...)

Generally speaking, however, most of HP's compiler languages DO include
"calling other languages..." sections in their manual.

With that in mind, I pulled up laserrom for 5.0 and found:

HP C Programmer's Guide

Printed in U.S.A.
HP Part No.  92434-90002
Edition E0194

In the section called "Comparing HP C and HP FORTRAN 77"

Table 3-2  shows the differences in storage allocation between HP C
and HP FORTRAN 77.  The notes the table refers to are located after the
table in the section called "Notes on HP C and HP FORTRAN 77."

          Table 3-2.  HP C versus HP FORTRAN 77 Storage

-----------------------------------------------------------------------
|             |              |                       |                |
| HP C Type   |   HP C       |  HP FORTRAN 77 Type   |  HP FORTRAN 77 |
|             | Description  |   Description         |                |
|             |              |                       |                |
|---------------------------------------------------------------------|
|             |              |                       |                |
| string      | --           | CHARACTER*n (See Note | --             |
|  (char *)   |              | 3)                    |                |
|             |              |                       |                |
-----------------------------------------------------------------------
note 3.  HP FORTRAN 77 passes strings as parameters using string
         descriptors corresponding to the following HP C declarations:

                    char *char_string;  /* points to string */
                    int len;            /* length of string */




> -----Original Message-----
> From: Mark Wonsil [mailto:[log in to unmask]]
> Sent: Wednesday, September 20, 2000 11:04 AM
> To: [log in to unmask]
> Subject: [HP3000-L] Calling all languages
>
>
> Could someone point me to a reference which shows how to
> write subroutines
> in one language (Maybe C) so they are easily called by other
> languages.  For
> example, when passing a string from Fortran to C, the string
> and length must
> be passed.
>
> TIA,
>
> Mark Wonsil
> 4M Enterprises, Inc.
>

ATOM RSS1 RSS2