Related articles |
---|
Symbols in library. atandin@free.fr (2003-07-31) |
Re: Symbols in library. v.Abazarov@attAbi.com (Victor Bazarov) (2003-08-04) |
Re: Symbols in library. artiegold@austin.rr.com (Artie Gold) (2003-08-04) |
Re: Symbols in library. alfps@start.no (2003-08-10) |
Re: Symbols in library. atandin@free.fr (2003-08-20) |
Re: Symbols in library. kamalp@acm.org (2003-08-23) |
Re: Symbols in library. vbdis@aol.com (2003-08-23) |
Re: Symbols in library. david.thompson1@worldnet.att.net (Dave Thompson) (2003-09-01) |
From: | atandin@free.fr (Torbak) |
Newsgroups: | comp.compilers,comp.lang.c++ |
Date: | 20 Aug 2003 01:20:22 -0400 |
Organization: | http://groups.google.com/ |
References: | 03-07-214 03-08-021 |
Keywords: | C++, linker |
Posted-Date: | 20 Aug 2003 01:20:22 EDT |
Thanks for thoses answers.
About :
"2- Even symbols which are not "static" have there decorated name in
the library. (I use bindump to check that). How can I avoid that for
the private functions of my lib ?", in fact I make a mistake. I
should say "Even symbols wich ARE 'static' have there ..."
I fact my question should be shortly discribe like this : Libraries
are files wich contain compiled code. Then to be linked, they contain
symboles description to discribe to the linker where it can find
functions which are accesible in the library. When I programme my
lib, I distingue 2 types of functions : those which will be "public",
means appear in header file, could be called from other compomnent of
the prog ... And those wich should not be called by others.
ex :
/* private stuff */
static char textTab[] = {"Hello", "By" };
static void DisplayText( int i ) {
sprintf("I say :%s/n", textTab[i&1] );
}
/* public stuff */
void Talk( void ) {// my public function
int i = rand();
DisplayText(i); // call private function
}
in mylib.h
extern "C" void Talk( void );
When I compile my stupid lib (I don't checked if what I wrote is
good), in release mode with no debug information etc ... I'll find
all symbols in the lib using dumpbin ... "textTab", "DisplayText" and
of course "Talk".
I expected to find only my public "Talk" function and not the other
symbols like "DisplayText(int)".
Because for me, the "DisplayText" function should be linked directly
in the library, and no any information about it should appear in the
release object. I wounder find the same thing than if the
"DisplayText" function was not exist like : void Talk( void ) {// my
is alone. No call to "private" functions.
sprintf("I say :%s/n", textTab[rand()&1] );
}
Of course, this exemple is simple because my private function is
called one time, and could be inlined.
So in general I wounder something like this :
0x000xxx afunctionDescriptor // adress of my private func.
0XOOOyyy Talk(void)
...
call afunctionDescriptor // call or jmp ...
ret
So if I use long description function name and many little functions,
my lib will be larger than if I use short function name with big
functions ?
I use microsoft C compiler.
PS : I tried namespaces but it doen't change anything.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.