I have a class A:
class A
{
public:
A() {}
virtual ~A() {}
void Func();
};
and another class M using A. I want to create libM.so which hidden all A's symbols. I using the following script to compile it:
g++ -c A.cc -fPIC -fvisibility=hidden
g++ -c M.cc -fPIC
g++ -shared -z defs -o libM.so M.o A.o
But when I using "nm -DC libM.so", it still has
0000000000000c78 W A::A()
0000000000000c78 W A::A()
I search this question on google and found another gcc option: "-fvisibility-inlines-hidden" to hidden inline functions, but I still got the same result even add this option when compile A.o
g++ -c A.cc -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
Why "-fvisibility-inlines-hidden" doesn't have effect? How do I prevent A::A() to appear in libM.so's export symbol? Thank you very much!