Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!uw-beaver!rice!brazos!rich From: rich@Rice.edu (Carey R. Murphey) Newsgroups: gnu.gcc Subject: Re: Linking gcc and Sun f77 code? Message-ID:Date: 24 Sep 89 21:56:14 GMT References: Sender: root@rice.edu Distribution: gnu Organization: EE Dept, Rice University Lines: 32 In-reply-to: abair@turbinia.oakhill.uucp's message of 23 Sep 89 06:32:49 GMT I hope this is of general interest to others who use gcc and link in fortran subroutine libraries. (I could not reach Alan Bair directly.) There is a discussion on how to call fortran subroutines from C code in the Unix Programmers Manual Volume 2, published by Holt, Rinehart and Winston, ISBN 0-03-061743. The section `Inter-Procedure Interface' pp 407-409 describes how to call fortran subroutines from C language code. Here's an example of a C language declaration for a linpack subroutine which does singular value decomposition: int dsvdc_( double *x, int *ldx, int *n, int *p, double *s, double *e, double *u, int *ldu, double *v, int *ldv, double *work, int *job, int *info); Where the fortran language definition is: subroutine dsvdc(x,ldx,n,p,s,e,u,ldu,v,ldv,work,job,info) integer ldx,n,p,ldu,ldv,job,info double precision x(ldx,1),s(1),e(1),u(ldu,1),v(ldv,1),work(1) Note that there is an underscore appended to fortran subroutine names by Sun's f77 but this varies between other fortran compilers. Good Luck! Rich -- Richard-Murphey@Rice.edu Electrical & Computer Engineering Dept.