libraries - where does the compiler look for and in which order

Hi,

if there is more than one instance of a library, where does the compiler look for an in which order?