Hmm, I know that I'm very stupid, but why are you assigning a callback function to an event, and what is your "eventuserdata" supposed to mean?

Callback functions are usually passed to a library in function arguments. They are stored in a function pointer and then called like any other function.