Check C library version (dynamic loading)

I have a program that requires certain library versions (libgstreamer example), so an older version will not work. Due to lazy binding, it is possible that my program will reference gstreamer version 10.23, which lacks some of the characters present in 10.25 that I use. My question is how can I check which version of the library is installed without using the package manager for this. Is it possible to load a library from C program, check its version number using dlopen (), maybe?

Edit: I am working on a Linux system

Edit 2: Maybe I can use readelf -V?

Thank!

+3
source share
3 answers

, , .

-, , Linux - , - , .

configure script Makefile .

, , , - , - . , , , .

GStreamer, , :

void gst_version(guint *major, guint *minor, guint *micro, guint *nano);
Gets the version number of the GStreamer library.

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstVersion.html

, .

, . , ( ).

+3

, dlopen dlsym , . . : http://linux.die.net/man/3/dlopen

+2

ltrace strace

ltrace -f -e dlopen ./<theapp>
strace ./<theapp> 2>&1| grep 'dlopen.*'

PS!

0

All Articles