title: Visual C++ : replace malloc/free
body: <p>I'm trying to replace standard <code>C</code> functions with my own implementation.</p>
  
  <pre><code>void* malloc(size_t size) {}
  void free(void*) {}
  </code></pre>
  
  <p>gives me the following warnings/errors:</p>
  
  <pre><code>1&gt;main.cpp(26): warning C4273: 'malloc': inconsistent dll linkage
  1&gt;  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\corecrt_malloc.h(97): note: see previous definition of 'malloc'
  1&gt;main.cpp(31): warning C4273: 'free': inconsistent dll linkage
  1&gt;  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\corecrt_malloc.h(85): note: see previous definition of 'free'
  1&gt;ucrtd.lib(ucrtbased.dll) : error LNK2005: _free already defined in main.obj
  1&gt;ucrtd.lib(ucrtbased.dll) : error LNK2005: _malloc already defined in main.obj
  1&gt;     Creating library ..\bin\\app.lib and object ..\bin\\app.exp
  1&gt;..\bin\\app.exe : fatal error LNK1169: one or more multiply defined symbols found
  </code></pre>
  
  <p>Is there a way to replace <code>malloc</code>/<code>free</code> function in Visual C++ 2015 without using <code>#define</code>? (I use third party libs and do not want to modify theirs code).</p>