Linking with multiple versions of a library

Thanks for all the responses. I have a solution that seem to be working. Here’s the problem in detail with an example. In main.c we have: #include <stdio.h> extern int foo(); int bar() { printf(“bar in main.c called\n”); return 0; } int main() { printf(“result from foo is %d\n”, foo()); printf(“result from bar is %d\n”, … Read more

Linking a shared library against a static library: must the static library be compiled differently than if an application were linking it?

You do not have to use PIC code in shared objects (as you have discovered you can use the -mimpure-text option to allow that). That said, non-PIC code in shared objects are more heavyweight. With PIC code, the text pages in memory are just direct memory mappings of the text pages on disk. This means … Read more

What is the difference between LD_LIBRARY_PATH and -L at link time?

There are two answers to this question, part of the answer lies in the compile-time linking (i.e gcc -lfoo -L/usr/lib … which in turn calls ld), and run-time linker lookups. When you compile your program, the compiler checks syntax, and then the linker ensures that the symbols required for execution exist (i.e variables / methods … Read more

Linking.canOpenURL returning false when targeting android 30 sdk on React Native

The answer lies in a new Android security feature: Package Visibility. This works similar to iOS’ LSApplicationQueriesSchemes. Targeting Android 11 (SDK 30) requires you to update your AndroidManifest.xml and include a list of applications you’re querying for. E.g. here’s the code I’m using to check for Google Maps navigation in my own app. It also … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)