Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: fwj@reg.triumf.ca (JONES,FRED_W.)
Subject: Mixed Fortran/C porting UNIX -> VMS headache
Date: 26 Jan 1993 11:16 PST	[thread overview]
Message-ID: <26JAN199311160883@reg.triumf.ca> (raw)

[cross-posted to comp.os.vms]

I have a large mixed Fortran/C application that has to run on
both Unix systems and VMS.  On all the Unix systems I have used,
the Fortran compiler adds an underscore (_) to the end of all
global symbol names.  Thus the declarations look like, e.g.:

      COMMON/EDGR_MX/MX,XDIG,YDIG,CODE
      LOGICAL MX
      REAL XDIG,YDIG
      BYTE CODE
          ...
      CALL MXSHELL(I,A)
          ...

struct {Bool mx; float xdig, ydig; char code;} edgr_mx_;
          ...
void mxshell_(i, a)
   int *i;
   float *a;
{
   [...etc.]


Unfortunately, VMS does not add the underscore suffix to the references,
rendering this type of application fundamentally non-source-code-portable
to VMS systems.

Thus the programmer is forced to use abominations like:

#ifdef VMS
struct {Bool mx; float xdig, ydig; char code;} edgr_mx;
#else
struct {Bool mx; float xdig, ydig; char code;} edgr_mx_;
#endif
          ...
#ifdef VMS
void mxshell(i, a)
#else
void mxshell_(i, a)
#endif
   int *i;
   float *a;
{
   [...etc.]

One could make jackets for all the C routines, but that still leaves
the common blocks.

Any DEC/VMS gurus know of a more elegant solution?


Thanks

Frederick Jones
fwj@reg.triumf.ca


             reply	other threads:[~1993-01-26 19:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-01-26 19:16 JONES,FRED_W. [this message]
1993-01-30  7:04 ` Mixed Fortran/C porting UNIX -> VMS headache pettengill
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox