This can't be answered without knowing the type of the
gDwlGlobals
variable, how it is initialised, and what
setupItemsNeedingHwnd()
is doing (what is assigned to the dialogs member).
But
void * address = &gDwlGlobals->dialogs;
gets the address of the
dialogs
member (the address of
gDwlGlobals
plus an offest) while
dwl::WinDialogs * d = gDwlGlobals->dialogs;
gets the value of the
dialogs
member (which is also a pointer).
These values will never be the same. It explains also why you have an offset of 20 bytes between
address
and
gDwlGlobals
shown by the immediate window.
One difference between debug and release builds is that variables are initialised with zero /
NULL
in debug builds while they contain random values in release builds. This applies not to global (static) variables which are always initialised with zero /
NULL
. But your
gDwlGlobals
is a pointer so that only the pointer is initialised with
NULL
.
Ensure also that your program has executed until a specific point before checking variables in the Immediate window. If you set for example a breakpoint on the
setupItemsNeedingHwnd()
line, that will not be executed. To see the effects of that function you have to set the breakpoint on the next line.