Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello once again,

I'm coding an static library and there is a one class.
But I don't understand why all the member variables and methods (all variables are private) are visible in generated lib file. Even the paths and project command line can be found there. As-well there is a lot other "unneeded" information. I have seen few Visual Studio static libraries stripped of all that stuff.

Please avoid comments of type "You will have to live with that". The most radical solution is using the dll to export only specified symbols + exe protector to get rid off all the other informations.

Thank you for help.
Posted
Comments
Philippe Mori 2-Sep-11 18:56pm    
I would think that common programmers don't bother with that and professionnal libraries would often export C style function and have a C++ wrapper in header file.

The library file needs to have that information since the header file you distribute for clients to use that class would also have the private variables and functions.

I would guess the libraries you've seen that do not include that information are using the pimpl-idiom (aka Opaque Pointer) to hide the underlying implementation details for their exported classes.

See: Effective C++ (3rd ed) Item 29
See Also: GoTW #28 The Fast Pimpl Idiom[^]

-PaulH
 
Share this answer
 
Comments
Philippe Mori 2-Sep-11 19:00pm    
Effectively, create a wrapper class (or even a C style wrapper) and export only stuff that need to be exported... By the way it should be a dynamic library also...
Paul Heil 2-Sep-11 19:09pm    
Yes, that's correct.
It will work fine for dynamically loaded libraries, too
How about the option /PDBSTRIPPED ? Any good for your purposes?
MSDN - "/PDBSTRIPPED (Strip Private Symbols)"[^]
 
Share this answer
 
Comments
Paul Heil 2-Sep-11 19:10pm    
That's for pdb files. He's concerned with .lib (COFF) files.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900