title: How to export C++ functions with GCC?
body: <p>I'm using Code::Blocks to compile a shared library on Ubuntu. When I make a simple main.c file with:</p>
  
  <pre><code>void* CreateInterface()
  {
      int* x = (int*)malloc( sizeof( int ) );
      *x = 1337;
      return x;
  }
  </code></pre>
  
  <p>This works fine and I can find the function CreateInterface with dlsym in another application. However, I want the function to create an instance of a class written in C++. I tried the following:</p>
  
  <pre><code>#include "IRender.h"
  
  extern "C"
  {
      void* CreateInterface()
      {
          return new Flow::Render::IRender();
      }
  }
  </code></pre>
  
  <p>This compiled fine, but now my other application fails to find CreateInterface. How should I deal with this?</p>