Hi,
How portable is weak linking?
#pragma weak my_symbol
I see that question: ow-to-make-weak-linking-work-with-gcc discusses how to get it working. But is there a good way to do this such that gcc is not required?
What is the difference between weak linking and guarding the declartion with an #ifdef?
#ifndef my_weak_fn
void my_w...
GCC has the ability to make a symbol link weakly via __attribute__((weak)). I want to use the a weak symbol in a static library that users can override in their application. A GCC style weak symbol would let me do that, but I don't know if it can be done with visual studio.
Does Visual Studio offer a similar feature?
...
I am trying to add In App Purchase support to my app. I would like the app to still be able to support OS2.2.1, but IAP are not available unless the OS version is 3.0 or higher.
I have tried weak-linking the StoreKit framework. Basically, I have StoreKit.framework added to frameworks, but not in Link Binary With Libraries in the target...
Hi,
I'm building an application that takes advantage of Mac OS X 10.6-only technologies, but without giving up backwards compatibility to 10.5 Leopard.
The way I do this is by setting the 10.6 SDK as the base SDK, weak-linking all frameworks and setting the deployment target to 10.5 as described in:
http://developer.apple.com/mac/libr...
Due to the last release of the adMob package, I have added the MessageUI framework to my project. As I wish to deploy my application to 2.x OS devices, I have weak linked MessageUI as advised.
If I build for iPhone device 3.0, it works fine.
If I build for iPhone device 2.2.1, I get a link error: "ld: framework not found MessageUI"
W...
I have declared an external function with a GCC weak attribute in a .c file:
extern int weakFunction( ) __attribute__ ((weak));
Compiled object file has weakFunction defined as a weak symbol.
Output of nm:
1791: w weakFunction
I am calling the weak defined function as follows:
if (weakFunction != NULL)
{
weakFunction()...
I have an iPhone App linked against iPhone SDK 4.0 but as deployment target I selected OS 3.1. When I start the application on my iPod touch running 3.1.3 I get an error that the class NSURL cannot be found:
dyld: Symbol not found: _OBJC_CLASS_$_NSURL
Referenced from: /var/mobile/Applications/21ECAA8E-8777-4020-82F5-56C510D0AEAE/myTra...
I've got an iPhone app that's mainly targetting 3.0, but which takes advantage of newer APIs when they're available. Code goes something like this:
if (UIApplicationDidEnterBackgroundNotification != NULL)
[nc addObserver: self selector: @selector(irrelevantCallbackName:) name: UIApplicationDidEnterBackgroundNotification object: nil]...
In the iPhone SDK 3.2, [CLLocation getDistanceFrom:] was renamed to [CLLocation distanceFromLocation:]. My project is compiled with 3.2 as the Base SDK and a "Deployment Target" of 3.0, meaning frameworks only available in 3.2 are weak linked so my app can still run on 3.0.
If I change my calls to use the new name distanceFromLocation:,...
I'm looking to make my app compatible with older versions of iPhone OS. I did see weak linking mentioned as an option. Can I use OS version detection code to avoid code blocks that the OS can't handle? (Say iAD?)
if(OS >= 4.0){
//set up iADs using "NDA code"...
}
If yes, what goes in place of if(OS >= 4.0)?
...
I'm trying to create a universal iPhone app, but it uses a class defined only in a newer version of the SDK. The framework exists on older systems, but a class defined in the framework doesn't.
I know I want to use some kind of weak linking, but any documentation I can find talks about runtime checks for function existence - how do I ch...
Let's say in Apple API version 1.0, there is a class NSFoo with a property 'color'. API 1.1 adds property 'size'.
I want to know whether I can use the getter: myFoo.size
[myFoo respondsToSelector:@selector(getSize)] doesn't work as expected.
What's the correct way to find out if an object has a property? Thanks!
...
I ran into this problem while developing in Objective-C for iOS, but this should apply to any C/C++/Objective-C code using the Mac OS X/iOS linker. The solution is covered by another question, but I'm interested in the why.
Let's say I'm using a linking to a library which defines a constant. In a header file there is a declaration like ...