Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!usc!wuarchive!mit-eddie!mit-amt!peter From: peter@mit-amt.MEDIA.MIT.EDU (Peter Schroeder) Newsgroups: comp.sys.hp Subject: Re: Fortran Libraries ??? Summary: don't muck around with function names Keywords: linking Fortran and C Message-ID: <1249@mit-amt.MEDIA.MIT.EDU> Date: 20 Dec 89 16:43:50 GMT References: <2644@umbc3.UMBC.EDU> Reply-To: peter@media-lab.media.mit.edu (Peter Schroeder) Organization: MIT Media Lab, Cambridge MA Lines: 25 In article <2644@umbc3.UMBC.EDU> greg@cityzoo.acs.umbc.edu (Greg Sylvain,Lib 007,3929,4376834) asks how to link C and Fortran. I've done this on the 800 machines. The compiler (or linker) will not screw around with function names. So, `dsvdc()' from linpack can be called in C as `dsvdc()', no mucking around. Some companies think they do you some sort of favor by mucking around... I have seen underscores prepended, appended, names all CAPITALIZED, etc. You will probably want to isolate yourself from this in some header file. Also remember that on some machines to include a fortran function call in a C program forces you to do the final link edit from f77. Luckily on the HPs (I only tried this on 800 type machines) you only have to do what you would expect, that is link in -lcl for the Fortran runtime support. I am happily using linpack and blas from withing C++, I love it!!! On a related note, what corresponds to stderr in Fortran? I am using lsode and every once in a while it prints some error message to stdout which is not so nice since I am using it in a heavily pipe oriented environment. Subsequent parsers tend to choke on that stuff. Peter peter@media-lab.media.mit.edu