weak-linking

function that returns value from dlsym()?

泄露秘密 提交于 2019-12-21 22:47:41
问题 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 compile the linux lightscribe sample program hoping that I can link it against the OSX dylib (why the hell won't HP release an actual Cocoa SDK? LS has only been around for what? 6 or 7 years now?): void* LSHandle = dlopen("liblightscribe.1.dylib",

Weak link framework

一个人想着一个人 提交于 2019-12-19 02:32:26
问题 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" Where could I be wrong? 回答1: You are getting that error because you are building against a version of the SDK that does not implemement the MessageUI framework.

Weak link framework

流过昼夜 提交于 2019-12-19 02:32:16
问题 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" Where could I be wrong? 回答1: You are getting that error because you are building against a version of the SDK that does not implemement the MessageUI framework.

Different behavior of override weak function in shared library between OS X and Android

廉价感情. 提交于 2019-12-17 19:37:15
问题 I am encountering a different behavior between OS X and Android: There is a weak function foo in my shared library, I want to override it with strong function defined in my executable. I expect the the overridden also affect the calling inside the library Result: I got expected result on OS X, but failed on Android. Here is my test project: File: shared.h void library_call_foo(); void __attribute__((weak)) foo(); File: shared.c #include "shared.h" #include <stdio.h> void library_call_foo() {

Objective-C Check if Structs is defined

故事扮演 提交于 2019-12-13 04:24:43
问题 My iOS application can use an optional external 3rd party library. I thought of using this answer (Weak Linking - check if a class exists and use that class) and detect if the class exists before executing code specific to this library. However, I found out that this external library is not written as Objective-C classes, but rather as C STRUTS and functions. Is there a similar technique that would allow me to check if a C Strut or function exists? Or some better alternative to see if this

How to build an iOS framework with weak-linked CocoaPods libraries

北慕城南 提交于 2019-12-12 07:33:40
问题 I am trying to build an iOS Framework (Test.framework) using the new template offered by Xcode 6 for creating Cocoa Touch Frameworks. The framework has different dependencies (as AFNetworking or FacebookSDK) specified in a Podfile. I don't want dependencies to be included in the framework, I just want to link against them. The problem is that when I build the framework, the libPods.a is linked and included. Q: How can I link against libPods.a library, but not include it in the framework? More

How portable is weak linking? #pragma weak my_symbol

寵の児 提交于 2019-12-08 01:41:06
问题 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 weak linking and guarding the declartion with an #ifdef? #ifndef my_weak_fn void my_weak_fn(){/* Do nothing */ return;} #endif 回答1: #pragma is, by definition, not portable. And weak linking is done at link time (surprisingly enough). It allows a function

How portable is weak linking? #pragma weak my_symbol

耗尽温柔 提交于 2019-12-06 11:31:46
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 weak linking and guarding the declartion with an #ifdef? #ifndef my_weak_fn void my_weak_fn(){/* Do nothing */ return;} #endif #pragma is, by definition, not portable. And weak linking is done at link time (surprisingly enough). It allows a function (or any symbol, really) with the same signature to override another. That means a strong one will be chosen

function that returns value from dlsym()?

烂漫一生 提交于 2019-12-04 18:15:59
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 compile the linux lightscribe sample program hoping that I can link it against the OSX dylib (why the hell won't HP release an actual Cocoa SDK? LS has only been around for what? 6 or 7 years now?): void* LSHandle = dlopen("liblightscribe.1.dylib", RTLD_LOCAL|RTLD_LAZY); if (LSHandle) { LSError (*LS_DiscPrinter_ReleaseExclusiveUse)() = dlsym(LSHandle,

iOS Framework weak link: undefined symbols error

北战南征 提交于 2019-12-04 09:35:51
问题 I'm building my own framework which proposed to be distributed to other developers for including to their projects. This framework links optionally certain frameworks (e.g. CoreLocation). The problem is that when I link my framework to real stand-alone project which doesn't contain CoreLocation in Build Phases, I'm getting linker errors like 'Undefined symbols for architecture' when tryin to build this host-project Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_CLLocationManager",