typically with callbacks a void* is passed when setting the callback, and then when something calls the callback, they will pass it that void*. this allows users to cast the void* in to whatever data they need within the callback.
without this, only static/global data is accessible from within the callback, which is quite limiting.
alternatively, something like std::function or a templated function could be used instead, to allow us to pass a lambda for the callback and capture state.