home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / sgi / 11440 < prev    next >
Encoding:
Internet Message Format  |  1992-07-27  |  1.5 KB

  1. Path: sparky!uunet!gatech!news.ans.net!cmcl2!adm!news
  2. From: nobody@kodak.com
  3. Newsgroups: comp.sys.sgi
  4. Subject: RE: Calling Fortran Subroutines from C
  5. Message-ID: <31544@adm.brl.mil>
  6. Date: 27 Jul 92 14:06:44 GMT
  7. Sender: news@adm.brl.mil
  8. Lines: 33
  9.  
  10. >From:    NAME: Arup K. Ghose                 
  11.     FUNC: Biophys. & Compu. Chem.         
  12.     TEL: (518) 445-7059                   <GHOSEAK@A1@DSRGVJ>
  13. To:    "info-iris@BRL.MIL"@kodakr@mrgate@wpc
  14.  
  15.    
  16.           >Does any of you out there know how to call ForTran subroutine
  17.           >from a C program running on IRIX 3.3.2?
  18.           >For example, if I write a ForTran 77 program as follows:
  19.            
  20.              SUBROUTINE TEST (TEMP1, TEMP2, N)
  21.              DOUBLE COMPLEX TEMP1, TEMP2
  22.              DIMENSION TEMP1 (N,N), TEMP2 (N)
  23.                   :
  24.                   :
  25.              RETURN
  26.              END
  27.            
  28.           >How would I incorporate the above subroutine into my C program? 
  29.           >Do I need to create a header
  30.           >file for the above subroutine?  What switches do I use to
  31.           >compile the above subroutine (as a
  32.           >Fortran 77 program) and my C program?
  33.            
  34.           Assuming that the variable types matched in the two routines,
  35.           from the C routine call it with an _ (underscore) extension:
  36.           
  37.           test_(... , ... , ...);
  38.           
  39.           Similarly add an underscore (_) extension in the C modules that
  40.           you want to call from a fortran routine and call it without the
  41.           underscore extension. It works for me on the 
  42.    
  43.