title: Correctly defining DLL-interfaces with C++11/14
body: <p>I've read several times that passing STL objects like vector and string outside of a DLL boundary is bad practice because different compiler versions can generate different code for STL objects. Therefore, you should design a C-style interface and not pass STL objects at all. However, there are still some things unclear to me:</p>
  <p><strong>1. What is the 'boundary' of a DLL?</strong></p>
  <p>Is it right to say, that the boundary is where code is beeing <strong>compiled</strong> on DLL side? What if I define a .h file inside a DLL (f.e. to write a factory class) and use that header file in a different project? Is that .h file inside or outside the boundary of the DLL and why?</p>
  <p><strong>2. What is contained in a DLL?</strong></p>
  <p>Let' say I have a class Foo:</p>
  <pre><code>class Foo
  {
  public:
      __declspec(dllexport) void f1(); //instantiates v1 inside function
  private:
      unique_ptr&lt;vector&lt;int&gt;&gt; v1 = nullptr;
  }
  </code></pre>
  <p>If I only mark the function f1() with __declspec(dllexport), only this function should be contained in the DLL. How does the code inside f1() know what v1 is if v1 isn't contained in the DLL?</p>
  <p><strong>3. Passing objects out of a DLL-boundary using unique_ptr</strong></p>
  <p>I'm using unique_ptr almost everytime in my project. From what I understand,     returning a unique_ptr from a DLL would be bad practice because unique_ptr is an STL object. How can I instantiate an object inside the DLL and return a unique_ptr to it?</p>
  <p><strong>4. Why does defining interfaces or using PIMPL help to define an DLL interface?</strong></p>
  <p>I still have to convert my STL classes to C-style objects. And in the project using the DLL, I would have to somehow wrap the C-style objects inside STL classes again. I don't see any advantage of using interfaces or PIMPL in this case.
  Also, if I define an interface (class with pure virtual functions), wouldn't this have the same effect as just declaring the functions in my class with __declspec(dllexport)?</p>
  <pre><code>class IFoo
  {
  public:
      virtual ~IFoo() = 0 {};
      virtual void f1() = 0;
  }
  class Foo : public IFoo
  {
  public:
      void f1();
      //__declspec(dllexport) void f1(); //why use an interface if I can just declare the functions like this?
  }
  </code></pre>
  <p>How is the DLL-STL problematic solved in modern C++ 11/14 libraries? Are there any modern open-source libraries that I can have a look at?</p>