How to use dlopen to find out if this library is in the system?
Example:
Входные данне : libcrypt.so Выходные : Yes или No How to use dlopen to find out if this library is in the system?
Example:
Входные данне : libcrypt.so Выходные : Yes или No look at a sample example from man dlopen .
like that:
### dlopentest.c #include <stdio.h> #include <dlfcn.h> void main() { char filename[20]; scanf ("%s", filename); if (dlopen (filename, RTLD_LAZY)) printf ("yes\n"); else printf ("no\n"); } collect:
$ make dlopentest CFLAGS=-ldl cc -ldl dlopentest.c -o dlopentest check:
$ echo libcrypt.so | ./dlopentest yes $ echo beliberda | ./dlopentest no Source: https://ru.stackoverflow.com/questions/436681/
All Articles