Suppose you linked your application against version 1 of
libfoo and version 1 of
libbar. At the time you compiled your
application, libfoo defined a function called
logerror( ), and libbar did
not. But when version 2 of libbar came out, it
included a function called logerror( ). Since the
conflict was not known at compile time, your application
doesn't expect libbar to
contain this function. If your application happens to load
libbar before libfoo, it
will call libbar's
logerror( ) method, which is not what you want.
So, Mac OS X 10.1 introduced two-level namespaces, which the compiler
uses by default. (Mac OS X 10.2 does not introduce any changes to
two-level namespaces.) With this feature, you can link against
version 1 of libfoo and
libbar. The linker creates an application that
knows logerror( ) lives in
libfoo. So, even if a future version of
libbar includes a logerror( )
function, your application will know which logerror(
) it should use.