您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

使用g ++的符号可见性

使用g ++的符号可见性

公共或隐藏的符号仍然存在。nm显示所有符号。区别在于隐藏的符号对于动态链接器不可用,即,不能导出,也不能插入。

您可能还会喜欢以下内容 man gcc

   -fvisibility=default|internal|hidden|protected
       ...
       A good explanation of the benefits offered by ensuring ELF symbols
       have the correct visibility is given by "How To Write Shared
       Libraries" by Ulrich Drepper (which can be found at
       <http://people.redhat.com/~drepper/>)---however a superior solution
       made possible by this option to marking things hidden when the
       default is public is to make the default hidden and mark things
       public.  This is the norm with DLL's on Windows and with
       -fvisibility=hidden and "__attribute__ ((visibility("default")))"
       instead of "__declspec(dllexport)" you get almost identical
       semantics with identical Syntax.  This is a great boon to those
       working with cross-platform projects.
其他 2022/1/1 18:16:11 有270人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶