Linux dlopen: how to make lib manager boot

I have the same code compiled with different arch parameters (FMV does not work, since functions return sse and I cannot change "default" to something with sse) How can I create a meta library that checks the capabilities during loading processor and load the appropriate library? (without any dlsym machines)?

+4
source share
1 answer

One way to achieve what you want is to link to a dummy wrapper library that checks the processor capabilities at startup, loads the appropriate shared library, and then forwards all the function calls to their implementations in that shared library.

script. Implib.so :

$ gen-implib.py --dlopen-callback=load_mylib mylib_avx.so

load_mylib ( CPUID dlopen ) .

+2

Source: https://habr.com/ru/post/1692172/


All Articles