c++visual-studio-2010memory-leaksvisual-leak-detector

"The application was unable to start correctly" after including vld.h


I included vld.h, vld.lib and vld_x86.dll on my Win32 project with visual studio 2010. It builds properly but when I execute, it crashes with this message:

"The application was unable  to start correctly (0xc0150002). Click OK to close the application."

I run it with Dependency Walker but it shows side by side error as follows:

Error: The Side-by-Side configuration information for "D:\project\..\debug\VLD_X86.DLL" contains errors. The application has failed to start because its side-by-side configuration is incorrect.)

I have tried various ways including tinkering around with the manifest as suggested here:

https://vld.codeplex.com/discussions/360243

It only runs properly if I commented the following line on vld.h

// Force a symbolic reference to the global VisualLeakDetector class object from
// the DLL. This ensures that the DLL is loaded and linked with the program,
// even if no code otherwise imports any of the DLL's exports.
//#pragma comment(linker, "/include:__imp_?g_vld@@3VVisualLeakDetector@@A")

However, if I commented out that line, the vld doesn't output anything at all (just like no vld integration)

Anyone having this problem before? Any suggestions will be appreciated, thanks in advance!


Solution

  • I had this problem too, you need to add all these files to the same directory as your vld_x86.dll/vl_x64.dll:

    Microsoft.DTfW.DHL.manifest

    dbghelp.dll

    Which came from the Win32/Win64 bin folder from Visual Leak Detector. Found this from: https://vld.codeplex.com/wikipage?title=Building%20Visual%20Leak%20Detector%20from%20Source