1 2 3 4 5 | typedef DWORD WINAPI xinput_fn_get_state(DWORD, XINPUT_STATE*); typedef DWORD WINAPI xinput_fn_set_state(DWORD, XINPUT_VIBRATION*); xinput_fn_get_state* xinput_get_state = [](DWORD, XINPUT_STATE*)->DWORD{return 0;}; xinput_fn_set_state* xinput_set_state = [](DWORD, XINPUT_VIBRATION*)->DWORD{return 0;}; |
Then later, the fn pointers get replaced by GetProcAddress() calls, as before.
Coming from languages that support lambdas, taking advantage of this new feature in C++ is appealing to me.
(I'm using GCC 4.9 under MinGW64; I assume this will work in the latest MSVC.)