From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,f7b215f0329d8991 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-01-30 16:10:05 PST Path: sparky!uunet!olivea!decwrl!pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!cvg.enet.dec.com!pettengill From: pettengill@cvg.enet.dec.com Newsgroups: comp.sys.dec Subject: Re: Mixed Fortran/C porting UNIX -> VMS headache Message-ID: <1993Jan30.070415.26746@nntpd.lkg.dec.com> Date: 30 Jan 93 07:04:15 GMT References: <26JAN199311160883@reg.triumf.ca> Sender: usenet@nntpd.lkg.dec.com (USENET News System) Reply-To: pettengill@cvg.enet.dec.com () Organization: Digital Equipment Corporation 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