Re: Weak linking
Re: Weak linking
- Subject: Re: Weak linking
- From: Greg Parker <email@hidden>
- Date: Fri, 07 Nov 2014 10:44:27 -0800
> On Nov 7, 2014, at 3:54 AM, Satyanarayana Chebrolu <email@hidden> wrote:
>
> Hi folks,
> We have an application, which is supporting from 10.5(Leopard) to 10.10(Yosemite). Inside the application, there is a custom framework(X.framework), which has some custom code for Appkit classes.
> Off late, decided to introduce a new feature, which will be supported from 10.7 to 10.10. And then subclassed the classes (NSTableRowView, NSTableCellView), which are part of the X.framework.
>
> Problem:
> The app is getting crashed when we launch it on 10.5 and 10.6 machines saying that “dyld: Symbol not found: _OBJC_CLASS_$_NSTableCellView”.
>
> Understand that NSTableRowView, NSTableCellView are not existing on 10.5 and 10.6, so the subclasses should be weakly linked.
Weak import of Objective-C symbols does not work on 10.5 and 10.6. The runtime support for it was introduced in 10.6.8.
One solution is to drop support for OS versions older than 10.6.8.
Another solution is to use dynamic framework loading to keep the code that uses NSTableCellView out of your process when the OS is too old. You would perform an OS version check and use NSBundle or dlopen to load your framework if the OS version is new enough. This works for anything.
Another solution is to use NSClassFromString(@"NSTableCellView") and never access the class directly. This works for classes that you use but do not subclass; it does not work if you need to subclass a class.
It is possible to create a subclass dynamically at runtime, after performing an OS version check. This is typically feasible only in simple cases.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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
References: | |
| >Weak linking (From: Satyanarayana Chebrolu <email@hidden>) |