title: Callbacks from C++ to C#
body: <p>I have a subject/observer system in C++:</p>
  
  <pre><code>#include &lt;vector&gt;
  class IObserver
  {
  public:
      virtual void valueChanged(float pos) = 0; 
  };
  
  class Subject
  {
  public:
      static Subject *instance();
      void subscribe(IObserver *observer);
  private:
      static Subject*                    m_instance;
      std::vector&lt;IObserver*&gt;            m_observers;
  };
  </code></pre>
  
  <p>I need to implement an observer in C# and subscribe to the subject.
  How do I do this?</p>
  
  <p>I could maybe use function pointers:</p>
  
  <pre><code>typedef void (*ValueChangedFunc)(float pos);
  void SubscribeTovalueChanged(ValueChangedFunc func); // global but works on singleton
  </code></pre>
  
  <p>How would I convert a C# member function to a C++ function pointer and call the last function?</p>