Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7044455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:24:42+00:00 2026-05-28T02:24:42+00:00

I can’t force msvc10 to put my const object into .rdata section. It always

  • 0

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;
}

Why obj1 is not going to rdata (checked in IDA) and how to force it in current situation? Tnx.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:24:43+00:00Added an answer on May 28, 2026 at 2:24 am

    These objects have nontrivial constructors, so they have to be initialized dynamically rather than statically. Because of that, they’re in the .data section (where all dynamically initialized objects lie, as their memory need to be mutated during initialization), even though the compiler was able to optimize out the constructor call in this case.

    Actually, nothing prevents the compiler from using .rdata in this case. It’s just that its developers didn’t implement this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anyone tell me if it is possible to convert a dojo charting object
Can we put functions to determine the condition for our list comprehensions. Here is
can any one tell me how can change this java code into objective c.is
Can you set the internal [[Class]] property of an ECMAScript object?
Can somebody point me to a resource that explains how to go about having
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Can you cast a List<int> to List<string> somehow? I know I could loop through
can you recommend some good ASP.NET tutorials or a good book? Should I jump
Can a LINQ enabled app run on a machine that only has the .NET
Can anyone tell me how I can display a status message like 12 seconds

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.