Write a runtime that gets called wenn calling a function in a struct. In this function set a pointer called this to the struct and then call the actual function.
It's that easy.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com