- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shared object symbol visibility
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2012 11:36 AM - edited 11-13-2012 11:37 AM
11-13-2012 11:36 AM - edited 11-13-2012 11:37 AM
shared object symbol visibility
I'm trying to compile a C++ shared object, and the weirdest thing happens. Whenever some code is in there, all the symbols from a certain compilation object dissappear. When I remove that code, they appear. For instance:
#include <boost/ptr_container/ptr_vector.hpp> namespace nsp { template <typename Type> struct Holder { boost::ptr_vector<Type> vec; }; class Object { int a; }; Holder<Object> holder; void testIt() { // holder.vec.push_back(new Object()); } }
$g++ -shared test.cpp -o test.so -I${BOOST_INCLUDE_GCC}/1.51
$ nm test.so | grep testIt | c++filt
[258] | 67118528| 32|FUNC |GLOB |0| .text|nsp::testIt()
But if I uncomment the line inside 'testIt', the 'nm' command shows nothing. If there's no 'Holder' template, just the 'vec', the symbols appears. If the type is just an 'int', the symbol appears.
What could be the cause of this?
$ g++ --version
g++ (GCC) 4.7.0
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -a
HP-UX rx8km B.11.31 U ia64 2229485251 unlimited-user license
- Tags:
- g++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2012 10:27 PM - edited 11-14-2012 11:43 AM
11-13-2012 10:27 PM - edited 11-14-2012 11:43 AM
Re: shared lib symbol visibility (hidden local symbol)
It would be helpful to run nm(1) on the object file instead of a shlib.
>If the type is just an 'int', the symbol appears.
The template type as in: ?
Holder<int> holder;
Or:
boost::ptr_vector<int> vec;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2012 05:42 AM
11-14-2012 05:42 AM
Re: shared lib symbol visibility
>It would be helpful to run nm(1) on an object file instead of a shlib.
What should be run on a shlib?
>>If the type is just an 'int', the symbol appears.
>The template type as in: ?
>Holder<int> holder;
>Or:
>boost::ptr_vector<int> vec;
Holder<int> holder;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2012 11:29 AM - edited 11-14-2012 11:43 AM
11-14-2012 11:29 AM - edited 11-14-2012 11:43 AM
Re: shared lib symbol visibility (hidden local symbol)
>What should be run on a shlib?
You already did this. Now run nm(1) on the object file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2012 11:32 AM
11-14-2012 11:32 AM
Re: shared lib symbol visibility (missing symbol)
I did that and the symbol appears. I tried using the shared object anyways and it worked even thou the nm does not show the symbol. Weird.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2012 11:42 AM
11-14-2012 11:42 AM
Re: shared lib symbol visibility (hidden local symbol)
>I did that and the symbol appears.
Can you provide the nm(1) output, perhaps the symbol is only local and so doesn't get put in the shlib symbol table?