RE: Same internal function name in libstdc++.so.5 and libjvm.so

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Can you change your link line so that libstdc++ is linked to before libjvm?  If I understand correctly, it should get the function our of the first library linked to that defines it (I could be wrong, though...)

Lyle Taylor

 -----Original Message-----
From: 	Ajay Bansal [mailto:abansal@xxxxxxxxxxxxx] 
Sent:	Thursday, September 04, 2003 5:17 AM
To:	gcc-help@xxxxxxxxxxx
Subject:	Same internal function name in libstdc++.so.5 and libjvm.so

Hi All


We are facing a "same function name" issue in two different libraries on
Linux. My program is linked with both libstdc++ and libjvm. I am using gcc
3.2.1 on Linux.

My code has following line : 

dynamic_cast<CSObject*>(m_unresolved)->WriteObject(lpszSString);

Which dumps core.

As it was not very clear why this piece of code can give a dump, I changed
the code as follows:

        if ( dynamic_cast<CSObject*>(m_unresolved))
	
dynamic_cast<CSObject*>(m_unresolved)->WriteObject(lpszSString);

 
Now core comes while executing "if" statement. I have checked for validity
of pointers "m_unresolved" and "lpszSString". Both are valid.   

On Linux, with gcc 3.2.1, dynamic_cast internally calls function
"__dynamic_cast". Problem is - this function is present both in
libstdc++.so.5 and libjvm.so. In our code, function from libjvm is being
called. If I change dynamic_cast to simple C style cast, everything works
fine. (nm for libstdc_++ and libjvm is given below)

----------------------------------------
[abansal@linux2 lib]$ nm -A *.so.* |grep __dynamic
libstdc++.so.5:00051bc0 T __dynamic_cast .so.5.0.1:00051bc0 T 
libstdc++__dynamic_cast

[abansal@linux2 lib]$ nm /usr/j2sdk1.4.1_02/jre/lib/i386/server/libjvm.so
|grep __dynamic
00485c34 T __dynamic_cast
----------------------------------------


Changing all dynamic_casts to simple C style casts in the code solves the
issue, but I know that that is undesirable. Can somebody please suggest us
what should we do in this case?


Regards
Ajay 
 



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux