这有效:
test1.h
namespace funcs {
extern "C" {
void a();
void b();
void c();
}
}
test1.cpp
namespace funcs {
void (*all[])() = {a, b, c};
}
extern "C" void hang() {
while (true);
}
#pragma weak a = hang
#pragma weak b = hang
#pragma weak c = hang
但这不会:
test1.h
namespace funcs {
void a();
void b();
void c();
}
test1.cpp
namespace funcs {
void (*all[])() = {a, b, c};
}
void hang() {
while (true);
}
#pragma weak funcs::a = hang
#pragma weak funcs::b = hang
#pragma weak funcs::c = hang
我认为这是由于#pragma weak
需要损坏的名称。有什么办法可以让编译器(GCC 4.7.3)为我发出损坏的名称?