I can t force msvc10 to put my const object into .rdata section. It always ends up in .data, perfectly initialised (means there is no dynamic initialisation/runtime constructor execution). (compiled with standard project settings of release build). I dont understand why the following code can t put obj1 into .rdata PE section:
typedef struct _Struct1 {
int m1;
_Struct1(int p1): m1(p1) {};
_Struct1() {};
} Struct1;
class Class1 {
public:
Class1() {};
Class1(int p1, int p2): m1(p1), m2_struct(p2) {};
int m1;
Struct1 m2_struct;
};
const Class1 obj1(1, 2);
int main() {
return 0;
}
为什么迷惑不解(由开发协会控制)? 如何在目前情况下迫使它? Tnx.