Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/138.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于在c+中隐藏符号的LD脚本+; < >我想使用GNULD版本脚本来隐藏C++共享库中不需要的符号。假设我的头文件如下所示: int a(); int a(int); class B { B(){} ~B(){} int x(int); }; std::ostream& operator<< (std::ostream& out, const B& b ); inta(); INTA(int); B类{ B(){} ~B(){} int x(int); }; std::ostream&operator_C++_Compilation_Linker - Fatal编程技术网

用于在c+中隐藏符号的LD脚本+; < >我想使用GNULD版本脚本来隐藏C++共享库中不需要的符号。假设我的头文件如下所示: int a(); int a(int); class B { B(){} ~B(){} int x(int); }; std::ostream& operator<< (std::ostream& out, const B& b ); inta(); INTA(int); B类{ B(){} ~B(){} int x(int); }; std::ostream&operator

用于在c+中隐藏符号的LD脚本+; < >我想使用GNULD版本脚本来隐藏C++共享库中不需要的符号。假设我的头文件如下所示: int a(); int a(int); class B { B(){} ~B(){} int x(int); }; std::ostream& operator<< (std::ostream& out, const B& b ); inta(); INTA(int); B类{ B(){} ~B(){} int x(int); }; std::ostream&operator,c++,compilation,linker,C++,Compilation,Linker,类似的东西应该可以做到: { global: extern "C++" { "a()"; "a(int)"; B::*; "operator<<(std::ostream&, B const&)"; }; local: *; }; { 全球的: 外部“C++”{ “a()”; “a(int)”; B::*; “运算符从ns::*导出符号但从ns::internal::*中排除符号

类似的东西应该可以做到:

{
global:
    extern "C++" {
        "a()";
        "a(int)";
        B::*;
        "operator<<(std::ostream&, B const&)";
    };
local:
    *;
};
{
全球的:
外部“C++”{
“a()”;
“a(int)”;
B::*;

“运算符从
ns::*
导出符号但从
ns::internal::*
中排除符号的任何方法?您可以在版本脚本中创建一组glob来完成此操作。类似于:
“ns::[!i]*”
“ns:i[!n]*”
“ns:in[!t]*"
,等等。但是在源代码中使用符号可见性注释可能更容易、更精确。哇,谢谢,这真是太棒了,而且效果很好!在源代码中使用注释可能不像版本脚本那么简单,因为我们有很多类/函数,逐个更改它们可能会很糟糕。你可能会发现你需要再导出几个与这些全局不匹配的符号。尤其是RTTI的typeinfo符号,如果您有虚拟函数,则需要导出vtable符号。相反,类上的单个可见性注释将导出与该类相关的所有内容。感谢您的建议,我们将对此进行评估,符号可见性注释确实非常有用比版本脚本更清晰。