home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / gnu / g / help / 1591 < prev    next >
Encoding:
Text File  |  1992-12-15  |  1.7 KB  |  43 lines

  1. Newsgroups: gnu.g++.help
  2. Path: sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!usc!sdd.hp.com!swrinde!cs.utexas.edu!torn!nott!bnrgate!bmerh85!bmerh85!hamish
  3. From: Hamish.Macdonald@x400gate.bnr.ca (Hamish Macdonald)
  4. Subject: Re: Has anyone made cfortran.h work with gcc?
  5. In-Reply-To: walter@cithe501.cithep.caltech.edu's message of 14 Dec 1992 23:17:18 GMT
  6. Message-ID: <1992Dec15.145009.4699@bmerh85.bnr.ca>
  7. Lines: 29
  8. Sender: news@bmerh85.bnr.ca (Usenet News)
  9. Organization: Bell Northern Research
  10. References: <1gj4luINNp7g@gap.caltech.edu>
  11. Distribution: gnu
  12. Date: Tue, 15 Dec 92 14:50:09 GMT
  13.  
  14. >>>>> On 14 Dec 1992 23:17:18 GMT,
  15. >>>>> In message <1gj4luINNp7g@gap.caltech.edu>,
  16. >>>>> walter@cithe501.cithep.caltech.edu (Chris Walter) wrote:
  17.  
  18. Chris> I would like to call Fortran routines from within my C++
  19. Chris> programs.  Has anyone managed to modify cfortran.h(a header
  20. Chris> file which allows one to easily call fortran routines within C)
  21. Chris> to work with gcc?  I contacted the author and he isn't aware of
  22. Chris> anyone who has done it.  I thought this might work:
  23.  
  24. Chris> extern "C" {
  25. Chris> #include "/users/walter/cfortran/cfortran.h"
  26. Chris> #define RANNOR(A,B) CCALLSFSUB2(RANNOR,rannor,FLOAT,FLOAT,A,B)
  27. Chris> }
  28.  
  29. Chris> but no luck. The linker complains it can't find 
  30.  
  31. Chris> rannor__Fp(some other stuff)
  32.  
  33. Chris> so clearly the compiler doesn't know rannor is foreign....
  34.  
  35. It looks like there is no prototype for "rannor" in "cfortran.h", so
  36. C++ is assuming "C++" linkage the first time it sees a reference to
  37. "rannor".
  38.  
  39. For C++ to know that "rannor" has "C" linkage, a prototype for it
  40. *must* exist in "cfortran.h".
  41.  
  42. Try adding a prototype to "cfortran.h" and see if that helps.
  43.