On Fri, 28 Aug 2009, Alex Riesen wrote: > On Fri, Aug 28, 2009 at 21:00, Nicolas Pitre<nico@xxxxxxx> wrote: > >> >> Microsoft's compiler and libraries? MacOSX? > >> > > >> > Are you saying you know those to be platforms with problems, or are you > >> > asking whether those platforms will have problems? > >> > >> Both: MS never had weak/vague linkage, but I don't know about MacOSX. > > > > This is not about weak or vague linkage. This is plain basic linker > > feature where no library object needs to be linked if there is no symbol > > to resolve. > > Maybe I missed something, but wasn't the idea to overwrite gettimeofday > with a public gettimeofday, defined in one of the object files? Yes, in test-date.o. > And shouldn't a linker complain regarding duplicated symbols, unless > the other (library) symbol is defined as a weak symbol, allowing > overriding it with another symbol of stronger linkage? Normally a linker would search for new objects to link only when there are still symbols to resolve. If the library is well architected (mind you I don't know if that is the case on Windows or OS X) you should find many small object files in a library, so to have only related functions together in a single object for only the needed code to be linked in the final binary. Hence the printf symbol should be in a separate object file than gettimeofday, etc. Only if the library's object file containing gettimeofday also contains another symbol pulled by the linker will you see a duplicated symbol error. But this is still a possibility. So your proposal is probably cleaner. Nicolas