title: Do (statically linked) DLLs use a different heap than the main program?
body: <p>I'm new to Windows programming and I've just "lost" two hours hunting a bug which everyone seems aware of: you cannot create an object on the heap in a DLL and destroy it in another DLL (or in the main program).</p>
  
  <p>I'm almost sure that on Linux/Unix this is NOT the case (if it is, please say it, but I'm pretty sure I did that thousands of times without problems...).</p>
  
  <p>At this point I have a couple of questions:</p>
  
  <p>1) Do statically linked DLLs use a different heap than the main program?</p>
  
  <p>2) Is the statically linked DLL mapped in the same process space of the main program? (I'm quite sure the answer here is a big YES otherwise it wouldn't make sense passing pointers from a function in the main program to a function in a DLL).</p>
  
  <p>I'm talking about plain/regular DLL, not COM/ATL services</p>
  
  <p>EDIT: By "statically linked" I mean that I don't use LoadLibrary to load the DLL but I link with the stub library</p>