title: Calling C# function from a C++/CLI function
body: <p>My project requires me to use C# to provide a user interface to C++. One of the C++ function I call does a bunch of work and provides periodic progress updates through another "object." Here's a example of what I mean.</p>
  
  <p>C++</p>
  
  <pre><code>class AppDelegate : public ProgressDelegate
      {
      void AppDelegate::UpdateStatusText(const char* text)
          {
          // Go() will end up calling me at some point.
          OutputDebugString(text);
          }
      void AppDelegate::ShowMessage(const char* text)
          {
          // Go() will end up calling me at some point.
          OutputDebugString(text);
          }
       };
  
  int CppWrapper::Go()
      {
      return cppInstance-&gt;Go()
      }
  </code></pre>
  
  <p>CSharp</p>
  
  <pre><code>void UpdateStatusText(String text)
     {
     //update UI
     }
  void ShowMessage(String text)
     {
     //update UI
     }
  </code></pre>
  
  <p>What I want to do is take updateStatusText and ShowMessage and pass the text over to C# to update my UI. My question is how do I expose the appropriate C# methods so that they can be called by my C++ code? Note that modifying Go is not an option for me.</p>