[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Determine g++ version used for compilation
From: |
Paul Pluzhnikov |
Subject: |
Re: Determine g++ version used for compilation |
Date: |
Sat, 07 Jun 2008 17:41:58 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
hemant.ritu@gmail.com writes:
> How can a C/C++ application which explicitly loads a C++ shared
Explicitly as in dlopen(...)?
> library at runtime determine the g++ version (and even libstdc++
> version) used for the compilation of the C++ shared library on Linux?
This is somewhat a hack:
If you know the absolute path where the library is coming from,
you could popen("objdump -p /path/to/dso | grep NEED") and find
out whether it uses libstdc++.so.5 or libstdc++.so.6.
You could also run 'strings' on that library, and get a very strong clue:
$ strings -a foo.so | grep GNU
GCC: (GNU) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
GCC: (GNU) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
...
If you don't know where the library will come from, you could
dlopen() it, then iterate over _r_debug.r_map link chain (see
/usr/include/link.h) to find its path.
But (AFAIK) there is no "proper API" you could call to find out.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.