home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / dec / 7139 < prev    next >
Encoding:
Text File  |  1993-01-27  |  1.6 KB  |  69 lines

  1. Path: sparky!uunet!destroyer!cs.ubc.ca!unixg.ubc.ca!reg.triumf.ca!fwj
  2. From: fwj@reg.triumf.ca (JONES,FRED_W.)
  3. Newsgroups: comp.sys.dec
  4. Subject: Mixed Fortran/C porting UNIX -> VMS headache
  5. Date: 26 Jan 1993 11:16 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Lines: 56
  8. Distribution: world
  9. Message-ID: <26JAN199311160883@reg.triumf.ca>
  10. NNTP-Posting-Host: reg.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.41    
  12.  
  13. [cross-posted to comp.os.vms]
  14.  
  15. I have a large mixed Fortran/C application that has to run on
  16. both Unix systems and VMS.  On all the Unix systems I have used,
  17. the Fortran compiler adds an underscore (_) to the end of all
  18. global symbol names.  Thus the declarations look like, e.g.:
  19.  
  20.       COMMON/EDGR_MX/MX,XDIG,YDIG,CODE
  21.       LOGICAL MX
  22.       REAL XDIG,YDIG
  23.       BYTE CODE
  24.           ...
  25.       CALL MXSHELL(I,A)
  26.           ...
  27.  
  28. struct {Bool mx; float xdig, ydig; char code;} edgr_mx_;
  29.           ...
  30. void mxshell_(i, a)
  31.    int *i;
  32.    float *a;
  33. {
  34.    [...etc.]
  35.  
  36.  
  37. Unfortunately, VMS does not add the underscore suffix to the references,
  38. rendering this type of application fundamentally non-source-code-portable
  39. to VMS systems.
  40.  
  41. Thus the programmer is forced to use abominations like:
  42.  
  43. #ifdef VMS
  44. struct {Bool mx; float xdig, ydig; char code;} edgr_mx;
  45. #else
  46. struct {Bool mx; float xdig, ydig; char code;} edgr_mx_;
  47. #endif
  48.           ...
  49. #ifdef VMS
  50. void mxshell(i, a)
  51. #else
  52. void mxshell_(i, a)
  53. #endif
  54.    int *i;
  55.    float *a;
  56. {
  57.    [...etc.]
  58.  
  59. One could make jackets for all the C routines, but that still leaves
  60. the common blocks.
  61.  
  62. Any DEC/VMS gurus know of a more elegant solution?
  63.  
  64.  
  65. Thanks
  66.  
  67. Frederick Jones
  68. fwj@reg.triumf.ca
  69.