850181p@aucs.UUCP (STEVEN E. PARKER) (03/03/89)
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??? ld does not seem to do the right thing... There might be a flag that I am not setting correctly. thanks .... ----------------------------------------------------------- Steven E. Parker Acadia Univ. School of Computer Science Wolfville N.S. Canada BOP1XO UUCP: {uunet|watmath|utai|garfield}!dalcs!aucs!850181p BITNET: 850181p@Acadia Internet: 850181p%Acadia.BITNET@CUNYVM.CUNY.EDU -----------------------------------------------------------
anthony@alberta.UUCP (Anthony Mutiso) (03/05/89)
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..... --------------------------------------------------------------------------------