I have a C library which use this function prototype, I want to use it in C++
int mlx_key_hook(void *win_ptr, int (*funct_ptr)(), void *param);
but in reality the function asked is
int funct_ptr(int keycode, void *param);
In fact I have this problem: Why put void in params?
Then, I ask you how can I call this function with the appropriate C++ funct_ptr ?
Or have I to re-compil this lib after having changed the funct_ptr prototype ?
This doesn't work:
mlx_key_hook(win_ptr, [](int keycode, void *param) -> int {
return 0;
}, NULL);
This work but that's not what I want:
mlx_key_hook(win_ptr, []() -> int {
return 0;
}, NULL);