Dennis Schridde schreef:
> Am Donnerstag, 28. Dezember 2006 13:46 schrieb Giel van Schijndel:
>   
>> 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...
>   
Results in the same indeed, so we basically said the same in another
wording.
>>> 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)
>   
No, I believe that MinGW creates a reference to [EMAIL PROTECTED] in the object
file for the source file containing main() (because MSW itself calls
[EMAIL PROTECTED] when starting an executable). And since libmingw32 defines
[EMAIL PROTECTED] this lib needs to be there somewhere on the linker command
line, where it appears on the command line will most likely not matter
(so you could place it as last if you'd wish to do so) as long as it is
specified after the file containing main().

--
Giel

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to