For Programmers: Free Programming Magazines  


Home > Archive > Fortran > April 2005 > Creating g95 libraries









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Creating g95 libraries
David Flower

2005-04-25, 8:58 am

I am running g95 under both Windows XP (home) and Linux (Red Hat 9.3),
and I am a relative newcomer to Linux.

I have a program which uses a subset of several hundred sub-programs,
and wish to put them into a library.

I have discovered the -l option which allows the linker to access a
library, but how do I produce a library containing several humdred
object files in the first place. I need to do this under both Linux and
windows.

Thanks in advance

Rich Townsend

2005-04-25, 3:59 pm

David Flower wrote:
> I am running g95 under both Windows XP (home) and Linux (Red Hat 9.3),
> and I am a relative newcomer to Linux.
>
> I have a program which uses a subset of several hundred sub-programs,
> and wish to put them into a library.
>
> I have discovered the -l option which allows the linker to access a
> library, but how do I produce a library containing several humdred
> object files in the first place. I need to do this under both Linux and
> windows.


Under Linux (and I expect Cygwin will be the same), you use the ar tool:

ar rc <libname.a> <file1.o> <file2.o> <file3.o> ...

This collects object files (<fileN.o> ) together into a static library
(<libname.a> ), which can then be linked against using the -l option.

cheers,

Rich
Tim Prince

2005-04-25, 3:59 pm


"David Flower" <DavJFlower@AOL.COM> wrote in message
news:1114427240.232211.223150@o13g2000cwo.googlegroups.com...
>I am running g95 under both Windows XP (home) and Linux (Red Hat 9.3),
> and I am a relative newcomer to Linux.
>
> I have a program which uses a subset of several hundred sub-programs,
> and wish to put them into a library.
>
> I have discovered the -l option which allows the linker to access a
> library, but how do I produce a library containing several humdred
> object files in the first place. I need to do this under both Linux and
> windows.

For making a library from .o files in Unix, linux and cygwin (32-bit) , try
'info ar' . Either lib, included in Microsoft developer packages, or
cygwin ar, will do the job for 32-bit Windows.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com