RSS Forums RSS

Query related to Hiding symbol in Shared Library

Please support our C advertiser: Programming Forums
Reply
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

  #1  
Dec 31st, 2008
Hi,

I have a question:

Suppose i have a source code file as

test.c
------------
#include <stdio.h>
void __attribute__ (( visibility ("hidden") )) sayHello (void)
{
   printf("hello");
}

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 8:38 am.
AddThis Social Bookmark Button
Reply With Quote  
Posts: 78
Reputation: fpmurphy is an unknown quantity at this point 
Solved Threads: 4
fpmurphy fpmurphy is offline Offline
Junior Poster in Training

Re: Query related to Hiding symbol in Shared Library

  #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 9:50 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the C Forum
Views: 333 | Replies: 1 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 12:40 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC