From: pettengill@cvg.enet.dec.com
Subject: Re: Mixed Fortran/C porting UNIX -> VMS headache
Date: 30 Jan 93 07:04:15 GMT [thread overview]
Message-ID: <1993Jan30.070415.26746@nntpd.lkg.dec.com> (raw)
In-Reply-To: 26JAN199311160883@reg.triumf.ca
In article <26JAN199311160883@reg.triumf.ca>, fwj@reg.triumf.ca (JONES,FRED_W.) writes:
|>
|>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?
|>
How about
#define foo_ foo
#define bar_ bar
in a VMS specific version of `os_defs.h'
mulp
DEC CVG - I break clusters, I don't write C
prev parent reply other threads:[~1993-01-30 7:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-01-26 19:16 Mixed Fortran/C porting UNIX -> VMS headache JONES,FRED_W.
1993-01-30 7:04 ` pettengill [this message]
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