DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C (http://www.daniweb.com/forums/forum118.html)
-   -   Query related to Hiding symbol in Shared Library (http://www.daniweb.com/forums/thread165229.html)

nabilchampion Dec 31st, 2008 9:36 am
Query related to Hiding symbol in Shared Library
 
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

fpmurphy Jan 2nd, 2009 10:49 am
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.


All times are GMT -4. The time now is 5:29 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC