Linking several object files

Roberto Bellasio rbellasio@enviroware.com
Wed Jul 5 11:49:00 GMT 2006


Thank you for your rapid and very useful answer.
Yes, I'm using the MinGW package.
I have created the archives as you suggested (I've also seen the
page http://gcc.gnu.org/wiki/GfortranBuild soon after sending my
previous message) and now I'm able to launch the linking command.
My problem has been solved. Now I have some linking errors, but I
should be able to solve them.
Thanks again.
Roberto

On Wed, 5 Jul 2006, Frangois-Xavier Coudert wrote:

> [I'm assuming that what you call DOS command line is in fact a Windows
> command line, and you're using the MinGW package, e.g. from the
> gfortran wiki]
>
> > gfortran -o myprog.exe f1.o f2.o ... fN.0
>
> I'd suggest you group your object files (except the main one, main.o)
> by small numbers into archive files (a1.a, a2.a, ... aP.a)  with P < N
> such that "gfortran -o myprog.exe main.o a1.a ... aP.a" fits in the
> command line.
>
> To create the archive files, you use the "ar" utility: for example,
> "ar cv a1.a f1.o f2.o f3.o" creates an archive file a1.a with the
> contents of the object files f1.o, f2.o and f3.o.
>
> I guess you could also use so-called "response file", which I don't
> know much about, but it seems if you enter "gfortran @foo", the file
> "foo" is read and its content is used as if it were command-line
> options and arguments. So, in your case, foo could probably contain
> "f1.o f2.o  ... fN.o".
>
> FX
>

---
Roberto Bellasio
ENVIROWARE srl
Centro Colleoni - Andromeda 1, 20041 Agrate Brianza (MI) - Italy
Tel +39.039.6890073     Fax +39.039.6881459
URL: http://www.enviroware.com
---



More information about the Fortran mailing list