Wow, I got it with the help of the IAs (you.com). I'm using the function for callbacks of C dll's, so they can be referenced to the object that is wrapping the calls. I'm porting an open-source C mqtt client (eclipse paho version) to Delphi (making the wrappers, that I'll make public when they are ready), and if you don't mind I will include this function in it, and I will make reference to you. Let me know what you think
PD: when I test a little more the function I will publish here ok?