Path: utzoo!attcan!uunet!ncc!alberta!anthony From: anthony@alberta.UUCP (Anthony Mutiso) Newsgroups: comp.unix.questions Subject: Re: linking "C" and FORTRAN functions together Message-ID: <237@snipe-lake.UUCP> Date: 5 Mar 89 00:38:10 GMT References: <1599@aucs.UUCP> Distribution: na Organization: U. of Alberta, Edmonton, AB Lines: 43 In article <1599@aucs.UUCP>, 850181p@aucs.UUCP (STEVEN E. PARKER) writes: > I am trying to find out how to link a fortran library > subroutine "SVD" into a "C" program. > I know that you have to compile the souce > to .o files but what do you do next??? Have a look at your Unix programmers manual "Fortran and Friends". It does say something about how to solve your problem, if memory serves. In general here is what you need to understand:- (1) Fortran data types are passed to functions by default in a manner that is different to the default C manner (especially text string, which have to include a byte length). (2) The f77 compiler will compile fortran code to names with two underscores. e.g.. the fortran procedure "map" will compile to the identifier "__map", while the C name "map" will compile to the identifier "_map". So to access the fortran subroutine in a C file the name "_map" will have to be used to reach the fortran name "map". Watch out of course for subroutine naming conventions, ie. calling a C function from the fortran program. I hope this is sufficient to get you going. Anthony. -------------------------------------------------------------------------------- Anthony Mutiso Email Department of Computing Science. anthony@UAlberta.AB.CA University of Alberta or anthony@alberta.UUCP Edmonton, Alberta CANADA Tel: (office) 403-432-2821 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Disclaimer: ...... angle and ministers of grace defend us all...... ...... lord protect the foolish..... --------------------------------------------------------------------------------