943,740 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 599
  • C RSS
Dec 31st, 2008
0

Query related to Hiding symbol in Shared Library

Expand Post »
Hi,

I have a question:

Suppose i have a source code file as

test.c
------------
  1.  
  2. #include <stdio.h>
  3. void __attribute__ (( visibility ("hidden") )) sayHello (void)
  4. {
  5. printf("hello");
  6. }

i make shared library using gcc say named as libhello.so

now although the function sayHello is not exported to the libhello.so
but when i run this command:

shell> nm libhello.so

the resultant display shows one of the symbol there as sayHello

Is this possible that I completely hide this symbol so that nm doesnt read this local symbol in the library.

Kind Regards
Last edited by nabilchampion; Dec 31st, 2008 at 9:38 am.
Reputation Points: 10
Solved Threads: 0
Light Poster
nabilchampion is offline Offline
25 posts
since Jul 2007
Jan 2nd, 2009
0

Re: Query related to Hiding symbol in Shared Library

You can use the strip utility to remove all the symbols from your object file.

Alternatively, declare sayHello() to be a static function.
Last edited by fpmurphy; Jan 2nd, 2009 at 10:50 am.
Reputation Points: 22
Solved Threads: 11
Junior Poster
fpmurphy is offline Offline
144 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Project/File design
Next Thread in C Forum Timeline: variable length array may not be initialized: error





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC