January 26, 2017 How does cast(SomeObj) (cast(void*) ptrFromC) work? | ||||
|---|---|---|---|---|
| ||||
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));
| ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply