Globally override malloc in visual c++

后端 未结 7 802
死守一世寂寞
死守一世寂寞 2020-12-06 01:47

I\'m trying to figure out a way to globally override malloc and related functions in visual c++ (2005). My setup is a dll with statically linked runtime library that consist

7条回答
  •  我在风中等你
    2020-12-06 02:11

    A solution I have used is to rebuild the Visual C++ C runtime library (crt) from source code.

    It can be found here in this folder:

    C:\Program Files\Microsoft Visual Studio 9.0\VC\crt

    Make sure you start up the Visual Studio command prompt to build it. Running nmake is enough to start it building although you might want to work out which target to build and this means you will have to understand the makefile.

    It may take an effort to understand how to build the crt, but once you have it building you can add your own code into malloc, free and realloc, etc.

    Unfortunately I have heard a rumour that we won't be able to build the crt from source code starting with Visual Studio 2010.

提交回复
热议问题