1

I need to get the pointer to an object's function. For the sake of not having to rewrite the rest of my program, I can't make the function static. I know that this is not impossible, in a sense, or maybe completely, but I've read that there's obscure ways to get it done.

If possible, what is the simplest way to do it? If not possible, what are some of the alternatives? The library I'm using requires a pointer to a function.

Tidas Bay
  • 93
  • 1
  • 1
  • 7
  • It is only possible if either you don't require any non-global state in your member function (i.e. no instance data members) or the function pointer type required by the library interface can take an additional parameter, often a `void*`, to provide custom data to the callback. – dyp Sep 24 '14 at 01:37
  • I don't think I can do either of those, then. I'll just static the function. My class uses self references, but I guess I need to make it static. How can I make it reference itself although it is static? I know people have asked this before, but many times I just don't get it. – Tidas Bay Sep 24 '14 at 01:50

0 Answers0