title: How to integrate dlmalloc in a Windows Phone 8 c++/cli application
body: <p>I'm attempting to integrate dough lea's malloc (malloc.c) into a native WP8 app.</p>
  
  <p>Adding the dlmalloc.c file to the <strong>MVS 2012 for Windows Phone</strong> results in a "cannot compile malloc.c with the /ZW option" error. Following this <a href="https://stackoverflow.com/questions/9304862/d8048-cannot-compile-c-file-openssl-applink-c-with-zw-option" title="post">post</a> I got rid of that problem.</p>
  
  <p>Then I got rid of the EINVAL and ENOMEM undefined errors by including errno.h at the start of malloc.c</p>
  
  <p>But now I'm stuck with different variations of:</p>
  
  <blockquote>
    <p>error C2375: 'malloc': redefinition; different linkage (in file stdlib.h)</p>
  </blockquote>
  
  <p>(for malloc, calloc, free and realloc)</p>
  
  <p>I tried setting the NO_MALLOC_STATS for the dlmalloc to stop the include of stdlib.h but that didn't seem to solve it, as well as #undef-ing calloc.</p>
  
  <p>Has anyone tried integrating dlmalloc in a wp8 app? If so, am I going the right way about it?</p>
  
  <p>Thanks,</p>
  
  <p>Jaime</p>