title: Using shared_ptr in dll-interfaces
body: <p>I have an abstract class in my dll.</p>
  
  <pre><code>class IBase {
    protected:
         virtual ~IBase() = 0;
    public:
         virtual void f() = 0;
  };
  </code></pre>
  
  <p>I want to get <code>IBase</code> in my exe-file which loads dll.
  First way is to create following function</p>
  
  <pre><code>IBase * CreateInterface();
  </code></pre>
  
  <p>and to add the virtual function <code>Release()</code> in <code>IBase</code>.</p>
  
  <p>Second way is to create another function</p>
  
  <pre><code>boost::shared_ptr&lt;IBase&gt; CreateInterface();
  </code></pre>
  
  <p>and no <code>Release()</code> function is needed.</p>
  
  <p><strong>Questions.</strong></p>
  
  <p>1) Is it true that the destructor and memory deallocation is called in the dll (not in exe-file) in <em>the second case</em>?</p>
  
  <p>2) Does <em>the second case</em> work well if exe-file and dll was compiled with different compilers (or different settings).</p>