Am Donnerstag, 28. Dezember 2006 13:46 schrieb Giel van Schijndel:
> Dennis Schridde schreef:
> > Am Donnerstag, 28. Dezember 2006 12:07 schrieb Dennis Schridde:
> >> Am Donnerstag, 28. Dezember 2006 02:17 schrieb Giel van Schijndel:
> >>>> A line like
> >>>> -ljpeg -lpng -lz -lmad -lvorbisfile -lvorbis -logg -lphysfs -lSDLmain
> >>>> -lSDL -lSDL_net -lGLU -lGL -lopenal works here (Linux/Makefile.raw)
> >>>>
> >>>> On Windows it would look like
> >>>> -ljpeg -lpng -lz -lmad -lvorbisfile -lvorbis -logg -lphysfs -lSDLmain
> >>>> -lSDL -lSDL_net -lmingw32 -lwsock32 -lwinmm -lglu32 -lopengl32
> >>>> -lopenal32
> >>>>
> >>>> That way the wsock and winmm stuff would still be linked before SDL...
> >>>
> >>> Actually ^^ that way (the windows command line you've provided) causes
> >>> wsock and winmm to be linked *after* SDL, which is exactly how it
> >>> should be.
> >>>
> >>> Currently, however, it looks like this on windows:
> >>>> -lwsock32 -lwinmm -lglu32 -lopengl32 -lopenal32 -ljpeg -lpng -lz -lmad
> >>>> -lvorbisfile -lvorbis -logg -lphysfs -lSDLmain -lSDL -lSDL_net
> >>>
> >>> So to acquire the line you've got you'd have to swap the global and the
> >>> if(windows) section. This however would still require another
> >>> if(windows) section (before the global one) since -lmingw32 needs to be
> >>> the first lib specified, otherwise linking will fail with unsatisfied
> >>> references to '[EMAIL PROTECTED]'.
> >>>
> >>> So as long as you make sure that the output set of libs is in this
> >>> order
> >>>
> >>> it should link:
> >>>> -lmingw32 -ljpeg -lpng -lz -lmad -lvorbisfile -lvorbis -logg -lphysfs
> >>>> -lSDLmain -lSDL -lSDL_net -lwsock32 -lwinmm -lglu32 -lopengl32
> >>>> -lopenal32
> >>
> >> Doesn't GCC link "from behind"? Means that it links the libs specified
> >> last in the commandline first?
> >> Now I am confused... ;)
>
> AFAIK gcc simply runs from left to right, creating a symbol table (of
> required symbols) on its way, and dropping all unreferenced symbols from
> memory. This means that you will need to provide the library (or linker
> object) that satisfies a dependency after the linker object that depends
> on it.
I think we might mean the same...

I understood it as:
GCC first links the last specified library, then the 2nd last and so forth.
That way, when a library uses a symbol from a library which is more behind, 
that symbol is allready present.

You say it goes from the 1st to the last and builds a list of required symbols 
which then get resolved when the appropriate library is linked.

I don't know how it is implemented, but in the end the result (and the 
resulting required order) should be the same...

> > PS:
> > In the automake build
> > LIBS="${LIBS} ${WZ_LIBS} ${WIN32_LIBS}"
> > is used, so the WIN32 libs are at the end, so they are linked first.
> >
> > They are set as
> > WIN32_LIBS="-lwsock32 -lwinmm"
> > (Without -lmingw32)
> >
> > Apparently the Windows compiles I did with this script work. How come???
> >
> > According to you it shouldn't even have compiled...
> > That it runs is even more interesting...
>
> Honestly, I don't why it does link for you, but doesn't link for me
> (i.e. without libmingw32).
Found "the issue". SDL's pkg-config allready specifies -lmingw32, so it get's 
linked last, even after SDL's own libs.
(Or linked first, depending on the view...)


With both views I wonder why a symbol -lmingw32 uses get's resolved by -lSDL, 
or the other way round: Why a symbol is defined by -lSDL and is required 
by -lmingw32...
Is that because of the SDLmain-magic SDL does? (Eg redefining main() and so 
on)

--Dennis

Attachment: pgpcb842BDnNO.pgp
Description: PGP signature

_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to