Questions tagged [weak-linking]
74 questions
1
vote
1 answer
function that returns value from dlsym()?
Stupid question that I'm sure is some bit of syntax that's not right. How do I get dlsym to work with a function that returns a value? I'm getting the error 'invalid conversion of void* to LSError (*)()' in the following code - trying to get the…

Jim Witte
- 100
- 1
- 10
1
vote
0 answers
Weakly linked template specializations
Is it possible to define weakly linked template specializations?
In math_functions.h I have:
namespace utils {
template
T_TYPE sqrt(T_TYPE value);
template <>
float sqrt(float value) __attribute__((weak));
template <>
double…

Erik Van Hamme
- 33
- 2
1
vote
1 answer
Strange linking behaviour with weak symbols (ARM-EABI unwinding routines __cxa_begin_cleanup)
I've got a problem with our ARM-EABI toolchain and/or libstdc++.
When I compile and link a simple C++ library consisting of the files
test.cpp, TestClass.cpp, TestClass.h
some unwinding support routines like __cxa_begin_cleanup are weak-referenced…

Thomas Schmid
- 116
- 10
1
vote
2 answers
Overriding functions from dynamic libraries
Hello I have a program with a global function that I'd like to customize at run time. Say, there are many versions of function foo() scattered over shared libraries. Now, based on system configuration detected at run time I'd like to use function…

kyku
- 5,892
- 4
- 43
- 51
1
vote
1 answer
How to use REAL function once it is declared as WEAK function in C?
I have a problem when using WEAK reference in C. Make assumption, I have the src code structure as follows:
//Eclipse C project structure
drv
| dummy
| | dummy_Test.h
| | dummy_TestWeakAttribute.h
| src
…

Thảo M. Hoàng
- 1,224
- 3
- 20
- 42
1
vote
2 answers
Can I set the property for a class, which hasn't been specified until run in OC?
I've got a fixed controller with dynamic views as its view. I want to set value for property of a certain view.
Here's code in the controller as below:
@property (nonatomic, retain) Class viewClass;
- (void)viewDidLoad {
[super…

Calios
- 806
- 9
- 23
1
vote
0 answers
Weak symbols in dylibs and dynamic binding on ios and osx
I've been hit by some weird behaviour recently that caused me to tear my hair out a little. I think I've finally worked out the problem and understand the cause but would like a sanity check on my conclusions. I'll skip the problem and just state…

Andrew Parker
- 1,425
- 2
- 20
- 28
1
vote
1 answer
Renamed methods with "Deployment Target" and weak-linking in Cocoa Touch
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…

Adam Ernst
- 52,440
- 18
- 59
- 71
1
vote
0 answers
Weak linking? External class? Is that possible
I'm straggling with that issue couple of days.
Issue is that we build the SDK while using cocoa pods internally. The result is going to be a closed source fat library with public headers. One of the pods is AFNetworking. IMO we shouldn't include…

Krzysztof Rutkowski
- 23
- 2
1
vote
0 answers
Overwriting a weak symbol of one shared library by another
I have a program that is linked against a (shared) library libFoo.so. Now I needed to write a patched version of that library. Call it libFooPatch although the name will be libFoo.so too. This one defines an additional weak symbol Init.
First…

Flamefire
- 5,313
- 3
- 35
- 70
1
vote
1 answer
-weak_framework linker arg not recognized by i686-apple-darwin11-llvm-gcc-4.2
I am trying to weak-link to the Security framework in Mac OS X (10.8.2, Darwin Kernel Version 12.2.1). It appears that the linker is simply not recognizing the '-weak_framework' tag.
This is the linker error I get -
[cc] Starting link
[cc]…

chicagozfinest
- 37
- 7
1
vote
2 answers
Testing for weak-linked symbol in iOS does not work as expected
I am running into a weird issue when trying to test for the existence of a symbol that is introduced in a newer version of the OS. I follow the Apple guidelines on using weak-linked symbols, i.e.
Check the availability of an external (extern)…

user102008
- 30,736
- 10
- 83
- 104
1
vote
1 answer
Inheriting from weakly linked iOS classes or classes not in deployment target iOS version
My code has a class in it (let's call it myRefLib) that inherits from UIReferenceLibraryViewController (part of UIKit Framework) which is a class that is only available in iOS 5 and above. I would like to have a deployment target of iOS 3.2.
If i…

delany
- 3,371
- 4
- 23
- 17
0
votes
1 answer
Implementation of weak function as static function
If I implement function as weak function in this way for example:
a.h:
int func1();
a.c:
#include "a.h"
__attribute__((weak)) int func1() {
...
}
Is it possible to implement this function in another file, for example X.c as a static function?…

user123454321
- 132
- 6
0
votes
2 answers
Problem with detection of UIPopoverController class availability when running on iPhone simulator
I work on an universal app that uses UIPopoverController for the iPad version. (Both the base SDK and the deployment targets are iOS 4.3)
When I use the iPhone simulator (version 4.3) to test conditional code paths for iPad and iPhone neither the…

Jonas
- 173
- 1
- 6