This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g77 building own library of subroutines


stephen.buckley@excite.com wrote:

> this is my third attempt to get this to the help list. Message follows:
> 
> I have a couple of fortran subroutines that I would like to put together in my own library [and then call them with other programs] and would like to know how to do this using g77--the manuals don't seem to say much on this--on building your own library of subroutines and functions etc.

Not surprisingly as this is mostly OS dependent.

On Unix it goes like this:

1. Make object files from your Fortran source code:

	g77 [compiler flags] -o <source>.f

2. Make a library from all object files:

	ar r <lib>.a *.o

3. [ Depending on the exact Unix OS you either do or do not do this step
]
   Make an index for this library:

	ranlib <lib>.a

Hope this helps,

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]