title: Export dll method which returns STL object
body: <p>I'm trying to export method from DLL which returns STL object. I'm using MFC.</p>
  
  <p>For example in my dll I have:</p>
  
  <pre><code>std::map&lt;CString, CString&gt; __declspec(dllexport) __stdcall MyMethod(CString str1, CString str2, bool boolValue)
  {
      //here create map
      std::map&lt;CString, CString&gt; map;
      map.insert(std::make_pair("key1", "value1"));
      return map;
  }
  </code></pre>
  
  <p>And I'm trying to load dll file in my exe app:</p>
  
  <pre><code>//Here I'm sure dll is loaded in proper way
  HINSTANCE dllHandle = dllHandle = LoadLibrary("mydll.dll");
  
  //Then I'm getting pointer to exported method:
  typedef std::map&lt;CString, CString&gt;(__stdcall *DllMyMethod)(CString str1, CString str2, bool boolValue);
  
  //This is my class member:
  DllMyMethod callMyMethod;
  
  //And getting this function pointer
  callMyMethod = (DllMyMethod)GetProcAddress(dllHandle, "MyMethod");
  </code></pre>
  
  <p>And unfortunately, <code>callMyMethod</code> pointer is empty. Exe app and dll app is created with Visual Studio 2013 with this same settings.</p>
  
  <p>How can I export this method in proper way?</p>