digitalmars.D.learn - How does cast(SomeObj) (cast(void*) ptrFromC) work?
- David Zhang (12/12) Jan 25 2017 I was trying to figure out why calling an object's function from
I was trying to figure out why calling an object's function from
a wndProc that modified the object's state didn't actually change
anything. Wrapping the GetWindowLongPtr in a cast(void*) seems to
make it work. What am I missing about this? I though that object
references were really just pointers with special
restrictions/behaviors?
Old:
window = cast(Win32Window) GetWindowLongPtr(hwnd,
GWLP_USERDATA);
New:
window = cast(Win32Window) (cast(void*)
GetWindowLongPtr(hwnd, GWLP_USERDATA));
Jan 25 2017








David Zhang <straivers98 gmail.com>