I can't get msvc10 to put my const object in the .rdata section. It always ends with .data, it is perfectly initialized (which means that dynamic execution of initialization / execution is not performed). (compiled with standard project settings for the "release" build). I do not understand why the following code cannot put "obj1" in the .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; }
Why is obj1 not going to rdata (checked in the IDA) and how to force it in the current situation? Tnx.
source share