title: Interrupt service routine in C++
body: <p>For a real time embedded system I'm trying to provide an interrupt handler, which allows for registering <em>any</em> non-static method pointer (as well as the object's instance of course), which gets called, when the interrupt occurs.</p>
  
  <p>In C, this was easy to do, e.g.:</p>
  
  <pre><code>void (*func)(void*) = 0; // &lt;- method to be called goes here
  void* instance;          // &lt;- instance for this-call goes here
  
  void InterruptHandler()
  {
    func(instance);
  }
  </code></pre>
  
  <p>Afaik, this meets the this-call C++ does implicitly when calling a non-static method.</p>
  
  <p>However, the C++ the compiler refuses to cast a method pointer to a function pointer (at least I found no way to do so) - which surely is comprehensible, but kind of counterproductive in my case.</p>
  
  <p>Is there any way to directly emulate the C++ this-call like in C?
  I'm aware of delegates, however my compiler is limited to C++98, no boost library, etc; and even custom lightweight implementations, e.g. Sergey Ryazanov's Impossibly Fast C++ Delegates, provide a certain overhead I'd like to avoid if possible.</p>