Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
- Subject: Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
- From: "email@hidden" <email@hidden>
- Date: Tue, 06 Sep 2011 23:32:36 +0100
On 6 Sep 2011, at 22:41, Greg Parker wrote:
> On Sep 6, 2011, at 2:34 PM, email@hidden wrote:
>> On 6 Sep 2011, at 22:11, Kyle Sluder wrote:
>>> On Tue, Sep 6, 2011 at 1:55 PM, email@hidden
>>>> To me this means that a framework will make its judgement of whether to modify its internal behaviour based on introspecting the application linkage.
>>>> This behaviour though seems to be rare and implementation details scare on the ground.
>>>
>>> The system frameworks often check the SDK version the application
>>> they're running within was linked against.
>>>
>> Can otool extract the SDK version?
>
> The LC_LOAD_DYLIB output from `otool -lv` shows the library version number as seen at link time. That's usually the value that is checked at runtime. To get an SDK number, you'd have to know which library version was present in each SDK.
>
Thanks Greg. Looking at the LC_LOAD_DYLIB output helped me clarify things.
I was totally overlooking the way in which minor framework versioning is implemented.
see http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Concepts/VersionInformation.html
The doc above below even explicitly states :
"When a program is linked with a framework during development, the linker records the compatibility version of the development framework in the program’s executable file."
Running otool -lv on the 10.6 SDK version of AppKit gives:
Load command 4
cmd LC_ID_DYLIB
cmdsize 88
name /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (offset 24)
time stamp 1 Thu Jan 1 01:00:01 1970
current version 1038.35.0
compatibility version 45.0.0
Running otool -lv on the 10.7 SDK version of AppKit gives:
Load command 4
cmd LC_ID_DYLIB
cmdsize 88
name /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (offset 24)
time stamp 1 Thu Jan 1 01:00:01 1970
current version 1138.0.0
compatibility version 45.0.0
A test project confirms that when built against the 10.6 SDK the app references 1038.35.0 as the AppKit current version.
When built against 10.7 it references 1138.0.0.
Within the context of an application binary then a frameworks recorded "current version" is the framework current version as recorded at link time.
The actual current version of the framework loaded at runtime may well be different.
Regards
Jonathan Mitchell
Developer
Mugginsoft LLP
http://www.mugginsoft.com_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden