How to make gcc link strong symbol in static library to overwrite weak symbol?

I am puzzled by the answer given by max.haredoom (and that it was accepted). The answer deals with shared libraries and dynamic linking, whereas the question was clearly about the behavior of static linking using static libraries. I believe this is misleading. When linking static libraries, ld does not care about weak/strong symbols by default: … Read more

GCC style weak linking in Visual Studio?

You can do it, here is an example in C: /* * pWeakValue MUST be an extern const variable, which will be aliased to * pDefaultWeakValue if no real user definition is present, thanks to the * alternatename directive. */ extern const char * pWeakValue; extern const char * pDefaultWeakValue = NULL; #pragma comment(linker, “/alternatename:_pWeakValue=_pDefaultWeakValue”)

Weak Linking – check if a class exists and use that class

TLDR Current: Swift: if #available(iOS 9, *) Obj-C, iOS: if (@available(iOS 11.0, *)) Obj-C, OS X: if (NSClassFromString(@”UIAlertController”)) Legacy: Swift (versions prior to 2.0): if objc_getClass(“UIAlertController”) Obj-C, iOS (versions prior to 4.2): if (NSClassFromString(@”UIAlertController”)) Obj-C, iOS (versions prior to 11.0): if ([UIAlertController class]) Swift 2+ Although historically it’s been recommended to check for capabilities (or … Read more