On Wednesday, 22 November 2017 at 15:17:33 UTC, Adam D. Ruppe
wrote:
On Wednesday, 22 November 2017 at 15:07:54 UTC, Stefan Koch
wrote:
&this will do.
Even if it were an lvalue, that would be the address of a
local. You should basically NEVER do that with D classes.
Just `cast(void*) this` if you must pass it to such a function.
I am afraid what will happen when casting this reference to void *
glfwSetWindowUserPointer gives us a chance to provide a pointer
to userdata. so that in callback function, we can retrieve the
data and don't have to declare global variable.
class App {
public this() {
m_window = glfwCreateWindow();
glfwSetWindowUserPointer(m_window, cast(void *)(&this));
}
}
How do I use this function in Dlang?
sorry for my bad english.