静态库* .lib-带专用符号,VC ++ 2010 [英] Static Library *.lib - Strip Private Symbols, VC++ 2010

查看:135
本文介绍了静态库* .lib-带专用符号,VC ++ 2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在对静态库进行编码,并且只有一个类.
但是我不明白为什么所有成员变量和方法(所有变量都是私有的)在生成的lib文件中可见.甚至可以在此处找到路径和项目命令行.同样,还有许多其他不需要的"信息.我很少看到Visual Studio静态库中包含所有这些东西.

请避免使用您将不得不忍受"类型的注释.最根本的解决方案是使用dll仅导出指定的符号+ exe保护程序来摆脱所有其他信息.

谢谢您的帮助.

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.

推荐答案

库文件需要具有该信息,因为您分发给客户端以使用该类的头文件还将具有私有变量和函数. .

我猜想您所看到的不包含该信息的库正在使用pimpl-idiom(又名Opaque指针)来隐藏其导出类的基础实现细节.

请参阅:有效的C ++(第3版)第29项
另请参见: GoTW#28快速皮普习语 [
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


选项/PDBSTRIPPED怎么样?对您有好处吗?
MSDN-"/PDBSTRIPPED(带专用符号)" [
How about the option /PDBSTRIPPED ? Any good for your purposes?
MSDN - "/PDBSTRIPPED (Strip Private Symbols)"[^]


这篇关于静态库* .lib-带专用符号,VC ++ 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆