Query related to Hiding symbol in Shared Library

Reply

Join Date: Jul 2007
Posts: 25
Reputation: nabilchampion is an unknown quantity at this point 
Solved Threads: 0
nabilchampion nabilchampion is offline Offline
Light Poster

Query related to Hiding symbol in Shared Library

 
0
  #1
Dec 31st, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 95
Reputation: fpmurphy is an unknown quantity at this point 
Solved Threads: 5
fpmurphy fpmurphy is offline Offline
Junior Poster in Training

Re: Query related to Hiding symbol in Shared Library

 
0
  #2
Jan 2nd, 2009
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC