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 7576017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:49:19+00:00 2026-05-30T16:49:19+00:00

class SomeClass { //some members MemberClass one_of_the_mem_; } I have a function foo( SomeClass

  • 0

class SomeClass
{
//some members
MemberClass one_of_the_mem_;
}

I have a function foo( SomeClass *object ) within a dll, it is being called from an exe.

Problem

address of one_of_the_mem_ changes during the time the dll call is dispatched.

Details:

before the call is made (from exe):

             '&(this).one_of_the_mem_' - `0x00e913d0`

after – in the dll itself :

             '&(this).one_of_the_mem_' - `0x00e913dc`

The address of object remains constant. It is only the member whose address shift by c every time.

I want some pointers regarding how can I troubleshoot this problem.

Code :

Code from Exe

stat = module->init ( this,
object_a,
&object_b,
object_c,
con_dir
);

Code in DLL

Status_C ModuleClass( SomeClass *object, int index, Config *conf, const char* name)
{
    _ASSERT(0); //DEBUGGING HOOK
    ...

Update 1:

I compared the Offsets of members following Michael’s instruction and they are the same in both cases.

Update 2:

I found a way to dump the class layout and noticed the difference in size, I have to figure out why is that happening though.

linked is the question that I found to dump class layout.

Update 3:
Class layout difference between exe and dll, but don't know why yet
Final Update : Solved the problem, much thanks to Michael Burr.

it turned out that one of the build was using 32 bit time, _USE_32BIT_TIME_T was defined in it and the other one was using 64 bit time. So it generated the different layout for the object, attached is the difference file.

Diff in two classes due to sizeof `time_t'

  • 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-30T16:49:21+00:00Added an answer on May 30, 2026 at 4:49 pm

    Your DLL was probably compiled with different set of compiler options (or maybe even a slightly different header file) and the class layout is different as a result.

    For example, if one was built using debug flags and other wasn’t or even if different compiler versions were used. For example, the libraries used by different compiler versions might have subtle differences and if your class incorporates a type defined by the library you could have different layouts.

    As a concrete example, with Microsoft’s compiler iterators and containers are sensitive to release/debug, _SECURE_SCL on/off , and _HAS_ITERATOR_DEBUGGING on/off setting (at least up though VS 2008 – VS 2010 may have changed some of this to a certain extent). See http://connect.microsoft.com/VisualStudio/feedback/details/352699/secure-scl-is-broken-in-release-builds for some details.

    These kinds of issues make using C++ classes across DLL boundaries a bit more fragile than using straight C interfaces. They can occur in C structures as well, but it seems like C++ libraries have these differences more often (I think that’s the nature of having richer functionality).

    Another layout-changing issue that occurs every now and then is having a different structure packing option in effect in the different compiles. One thing that can ‘hide’ this is that pragmas are often used in headers to set structure packing to a certain value, and sometimes you may come across a header that does this without changing it back to the default (or more correctly the previous setting). If you have such a header, it’s easy to have it included in the build for one module, but not another.

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

Sidebar

Related Questions

Suppose I have a class that processes some data: class SomeClass { public: void
Let's say I have some Java code: public class SomeClass { static { private
I have seen some C++ classes with a destructor defined as follows: class someClass
What's the appropriate way to dispose an ImageList object? Suppose I have some class
I have a function that looks like this: class SomeClass { // ... };
I have the following scenario: public class SomeClass { // Have some other data
The use case is some what like this: public class SomeClass : ICloneable {
In some code I've been reading, I've come across this : class Someclass {
I have some class that I'm passing as a result of a service method,
Some class has ugly field called URL, but Id rather call it file. public

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.