title: Problem retuning a vector from a c++ dll to another c++ exe
body: <p>I have a function foo() in dll A.dll, whose definition is as follows </p>
  
  <pre><code>vector&lt;CustomObject&gt; foo()  
  {   
        vector&lt;CustomObject&gt; customObjectCollection;
  
     //code which populates customObjectCollection goes here
  
  return customObjectCollection;   
  }
  </code></pre>
  
  <p>I am referring this method vector foo() of dll A from exe B</p>
  
  <p>When i make a call to the function foo from B, I get an unhandled exception which says </p>
  
  <blockquote>
    <p>"unhandled exception at
    0x10487b3f(msvcp90d.dll) in B.exe"
    0xC0000005: Access violation while
    writing to the location 0xfdfdfdfd".</p>
  </blockquote>
  
  <p>Note:type CustomObject does not implement copy constructor</p>
  
  <p>When i tried to debug by attaching B.exe to A.dll, I found that inside method vector foo(), the vector gets populated without any problem but when the control returns to B.exe the valves in vector doesnot get copied !!! </p>
  
  <p>Also, if method foo returns vector by reference , exception doesnot occur and B.exe receives an empty vetor.</p>
  
  <p>what is the issue ?? Is it happening as I have not implemented copy constructor for CustomObject.</p>
  
  <p>Any help is greatly appreciated
  (Apologies for not articulating the question properly)</p>
  
  <p>Thanks<br>
  jeel</p>