Same symbol in more then one shared library

LLeweLLyn Reese llewelly@lifesupport.shutdown.com
Thu Mar 20 19:24:00 GMT 2003


"Ajay Bansal" <Ajay_Bansal@infosys.com> writes:

> Hi All
> 
> I have a class "CriticalSection" in one of my shared libs. My
> Application is linked to many thirdparty libs.

It seems likely to me that one of your thirdparty libs contians a
    CriticalSection symbol.

> 
> Now, if the class name is CriticalSection, objects are created but the
> constructor of my code is not invoked. That suspicously points to the
> fact that object of some other class with name "CriticalSection" is bein
> created. (If I change the name of my class to some other name, say
> MyCriticalSection, code works fine)
> 
> Now is there some way to tell from which particular shared lib, a symbol
> is being picked up???

I think you may be able to discern this from a map file. Read the docs
    on how to make your linker generate a map file. If gnu ld is your
    linker, I believe -Wl,-M will do the trick.

Please read:
http://gcc.gnu.org/onlinedocs/gcc-3.2.2/gcc/Link-Options.html#Link%20Options
    and scroll to the bottom of the page.

Please read:
http://sources.redhat.com/binutils/docs-2.12/ld.info/Options.html
    and search for '--print-map' .
    

> That way I'll which library is the culprit. I
> tried using "nm" to find the shared lib, but have not been able to do so
> successfully? 
> 
> Is it possible that some system library has a class with name Critical
> Section???

I think so, but I think a thirdparty lib is more likely the culprit.



More information about the Gcc-help mailing list