Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ library static VC10.0
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 2-Sep-11 8:03am
Comments
Philippe Mori at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Comments
Philippe Mori at 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 at 2-Sep-11 19:09pm
   
Yes, that's correct.
It will work fine for dynamically loaded libraries, too
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

How about the option /PDBSTRIPPED ? Any good for your purposes?
MSDN - "/PDBSTRIPPED (Strip Private Symbols)"[^]
  Permalink  
Comments
Paul Heil at 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
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 BillWoodruff 170
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 2 Sep 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100