Questions tagged [weak-linking]

74 questions
2
votes
1 answer

Can't compile code containing iOS 5 method when setting lower deployment target

Not true for all new iOS 5 methods but I've found out that calling UINavigationBar's setBackgroundImage:forBarMetrics: method will trigger an 'instance method not found' warning if the deployment target is under 5.0. This is even though I am linking…
Mihai Damian
  • 11,193
  • 11
  • 59
  • 81
2
votes
3 answers

What happens if I weak link all of the frameworks in my app?

What happens if I weak link all of the frameworks in my app? Can anything bad happen?
timesking
  • 275
  • 1
  • 3
  • 11
2
votes
0 answers

Compiling for iOS 10.3, but module 'SwiftUICharts' has a minimum deployment target of iOS 13.0

Any idea how I could import SwiftUICharts framework only if the iOS version is over iOS 13? I added this framework via File > Swift Package > add package dependency. My app target has to be iOS 10. I import this framework into a swiftui controller…
Abv
  • 354
  • 2
  • 13
2
votes
1 answer

Set GCC default attribute for all functions (get all function symbol to be weak for monkeypatching)

I am currently writing a C project that includes a separate test build. The tests are different C processes that uses the source code to test every defined function in my code (TDD). I want monkey patching in those tests. I took some time to see…
ninjaconcombre
  • 456
  • 4
  • 15
2
votes
1 answer

__attribute__((weak) ) function result in undefined reference

I am currently trying to set up CMock for unit testing the STM32 using MinGW and CMake. In my config file, I set the :weak: option so that the generated mock would give me weak functions. One example is: #if defined (__IAR_SYSTEMS_ICC__) #pragma…
Le Hoang Long
  • 428
  • 3
  • 10
2
votes
1 answer

why gcc can automatically tag a symbol as weak

We have built our code using gcc4.1.2, and we have used function "lstat64" that is defined in the "sys/stat.h" system header file and also defined in a third party library that we use. When we "nm" our executable, we find that: W lstat64 My…
mnabil
  • 695
  • 1
  • 5
  • 19
2
votes
2 answers

Redirecting assert fail messages

We have a software project with real-time constraints largely written in C++ but making use of a number of C libraries, running in a POSIX operating system. To satisfy real-time constraints, we have moved almost all of our text logging off of stderr…
Chris Beck
  • 15,614
  • 4
  • 51
  • 87
2
votes
2 answers

Does Android support weak symbols?

I've been looking at questions like: Cannot load library: reloc_library[1285]: cannot locate 'rand' Android app crashes in the start because java.lang.UnsatisfiedLinkError It seems to me this could be solved with weak symbols. That is, a native…
jww
  • 97,681
  • 90
  • 411
  • 885
2
votes
1 answer

How to avoid XCode framework weak-linking problems?

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…
Frank R.
  • 2,328
  • 1
  • 24
  • 44
2
votes
2 answers

Checking for availability of iOS classes (rather than methods) in MonoTouch

MonoTouch exposes the RespondsToSelector method for checking the availability of methods across iOS versions. However I can't seem to find out how to perform the similar checks for class availability. Apple documents it here that in iOS 4.2+ you…
Tyson
  • 14,726
  • 6
  • 31
  • 43
2
votes
1 answer

How portable is weak linking? #pragma weak my_symbol

How portable is weak linking? #pragma weak my_symbol I see that question: how-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…
JeffV
  • 52,985
  • 32
  • 103
  • 124
2
votes
1 answer

Does weak attribute only work with shared library in Linux GCC?

I am a newbie in Linux gcc. I am writing a simple code to learn the weak attribute in Linux gcc. See my sample code: weakref.c, the main file. I want to the file could work with or without foo method being defined. #include extern void…
Mingjiang Shi
  • 7,415
  • 2
  • 26
  • 31
2
votes
1 answer

Function with weak atributte can not be overwritten

I would like to overwrite function (interupt handlers) with the weak attribute, but linker does not link my definition. Codes are shorted for better reading. vectors.c void NMI_Handler (void) __attribute__((weak)); void HardFault_Handler (void)…
ehiker
  • 51
  • 3
1
vote
1 answer

Can you weak link(optional link) a static library in C++ like Objc could?

I am developing a static library A with a mix of Objective C and C++ in Xcode, I run into the need to "weak link" another static library and Let's call it B. A calls some methods defined in B. The idea is that if B is not linked/provided, A will not…
zfgo
  • 195
  • 11
1
vote
1 answer

Checking if a static function exists at compile time

function.c (I can't edit this file) #define FOO 1 #if FOO == 1 void Foo() {} #endif cpp class MyClass { #if FOO == 1 void CppFoo() { Foo(); } #endif } I want to do the same thing, but without using the define TEST in…