I have a problem with legacy 32-bit C application, built in Mac OS 10.4, with Xcode 2.2.0. It runs correctly on later (64-bit) systems (10.5 and later), but if I try to build it in later Xcode versions (2.2.1 - 3.2.6) on 10.5 and later, it's behavior changes, even though I set SDK 10.4 and GCC 4.0 everywhere (in "project settings" and "active target settings").
Details on changed behavior: when getting function addresses through CFBundleGetFunctionPointerForName()
and then calling them, some return pointers. Then:
If application is compiled in Xcode 2.2.0 in Mac OS 10.4, and running in 10.5+, pointers could not exceed
LONG_MAX
, so signed long is sufficient for storing call result.If application is compiled in Xcode 2.2.1+ in 10.5+ and running in 10.5+, pointers could be in range
LONG_MAX..ULONG_MAX
.
And interpreting result as signed long is essential, because functions, returning signed long (not pointers), are called exactly the same way. Changing it would be making a kludge, so please don't suggest splitting calls to functions that return pointers and functions that return result immediately - it would be done only if I cannot get a correct build.
This difference of builds' behavior I could explain only as calling in runtime some other bundles than an older build would call - and that is possible if 1) CFBundle library, which calls functions, is not the same as in real 10.4, or 2) system correctly determines SDK of an older build, and uses the correct "backward compatibility", but something in newer program settings is wrong, and so other bundle is called in runtime.
So I wonder, are there any "hidden" options in Xcode or its backends, that make a difference between real 10.4 build and build against 10.4 SDK in later OS? Or how I can search for such differences?