This is defined in CoreService 10.3 or later but not in earlier
versions.
If I build my code with the CoreServices Framework 10.3 then it
works OK on 10.3 machines. However, when I run it on 10.2 machines
the program does not run:
undefined reference to _CFLocaleCopyCurrent expected to be in
CoreServices
How can I build my code so that I can use this function in the user
is running OSX 10.3 and not have this error (and not use the
function) if they are running OSX10.2?
What deployment target are you building for? (This is different than
which SDK you're using.) If your deployment target is set to 10.3+,
then all 10.3 functions you call must be available or your
application won't launch. If you set your deployment target to 10.2
(or 10.1 or 10.0) then 10.3 and later functions will be weak-linked.
Then it's up to you to add a runtime check to correctly handle the
pre-10.3 and 10.3+ cases (and to prevent a crash from calling a non-
existent function). For example, something like this should work for
your case:
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
if (CFLocaleCopyCurrent == NULL)
{
// do something equivalent to CFLocaleCopyCurrent
// for the 10.0, 10.1 and 10.2 cases
}
else
#endif
{
CFLocaleCopyCurrent(...);
}
Note that I specifically added the #if...#endif conditional around
the pre-10.3 code block so that if the minimum OS version required is
later changed to 10.3 or later, then the pre-10.3 "emulation" code is
no longer included.
steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden