| Subject: | Re: Determine g++ version used for compilation |
|---|---|
| From: | hemant.ritu@xxxxxxxxx |
| Date: | Sun, 8 Jun 2008 22:14:31 -0700 (PDT) |
| Newsgroups: | gnu.g++.help |
Thanx Paul. The objective is to ensure that different C++ shared
objects compiled using mismatching versions of g++ (e.g. 3.x.x and
4.x.x) are not dlopen'ed by the C application because it can cause
runtime errors. We assume that the given solutions are best suited
here. Thanx.
On Jun 8, 5:41 am, Paul Pluzhnikov <ppluzhnikov-...@xxxxxxxxx> wrote:
> hemant.r...@xxxxxxxxx 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.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Determine g++ version used for compilation, Paul Pluzhnikov |
|---|---|
| Next by Date: | Re: stl_alloc substitution, Bernd Strieder |
| Previous by Thread: | Re: Determine g++ version used for compilation, Paul Pluzhnikov |
| Next by Thread: | stl_alloc substitution, oliverpelz@xxxxxxxxxxxxxx |
| Indexes: | [Date] [Thread] [Top] [All Lists] |