This project has moved and is read-only. For the latest updates, please go here.

Windows 2008

May 14, 2010 at 1:13 PM

I downloaded the latest srcs to C:\development\vld and built vld on my Windows 2008 32 bit box using VStudio 2008

I built the vld dll using the sln file which output the dll to C:\development\vld\Win32\Debug.

I run the console test program which works fine.

 

However when I call malloc from my C Dll vld cannot load the C runtime library which it needs...

 

TEMPLATE_HEADER
void* CrtMfcPatch<TEMPLATE_ARGS>::crtd_malloc (size_t size)
{
    static malloc_t pcrtxxd_malloc = NULL;

    context_t context;
    HMODULE msvcrxxd;

    CAPTURE_CONTEXT(context);

    if (pcrtxxd_malloc == NULL) {

        // This is the first call to this function. Link to the real malloc.


wprintf(crtdll);

       msvcrxxd = GetModuleHandle(crtddll);
        pcrtxxd_malloc = (malloc_t)GetProcAddress(msvcrxxd, "malloc");
    }

    return vld._malloc(pcrtxxd_malloc, context, size);
}

 

The crtdll template argument is 'msvcr90d.dll' I have confirmed this by placing the printf in the code, this is the same one as vldconsole app uses and prints out...

Any ideas?

 

I have noticed that even though I compile the exe that calls my dll in the same way as the vldconsole, ( same CodeGeneration flags...  /Gm /EHsc /RTC1 /MTd ) and similarly to my Dll, and made sure that the vld include file was specified it does not call the same  CrtMfcPatch<TEMPLATE_ARGS>::crtd_malloc (size_t size) functions as the dll but seems to only call the standard c runtime...

 

 

May 14, 2010 at 1:41 PM

If I replace the path of msvcrt90d.dll in crtmfcpatch.h to the full path of the dll I am using this works...

const extern wchar_t msvcr90d_dll[] = L"C:\\Windows\\winsxs\\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\\msvcr90d.dll";

Oct 13, 2010 at 10:44 AM
Edited Oct 13, 2010 at 4:55 PM

I am facing to the same issue... Although I see that msvcr90.dll is loaded, Vld failed to retrieve the module handle, and then crash. I am not sure that this is only related to Vld, but I am not enough familiar with "side-by-side" assemblies to correctly understand where is the problem. Like MrJazzy, if I set the full path of the dll, it works; but this is not a satisfactory solution in my case... :/

I use Vs2008, Windows XP SP3, and my project try to mix MFC and Qt libraries (I think it could be the reason of some strange combinations...)

I am opened to any help, suggestions, remarks :)

NB: Congratulation for Vld, I was looking for a powerful tool to track memory leak, and able to manage Qt "static" memory: except this problem, Vld seems to be THE good solution :)

 

[EDIT]

I am wondering what happen if msvcr90.dll is linked staticly with the program (/MT(d) instead of /MD(d) ?)... Does GetModuleHandle return a valid value? I didn't succeed to find an official answer to this question, but my tests make me think that it cannot work with static linkage... Am I wrong?

Dec 28, 2010 at 11:12 AM
Edited Dec 28, 2010 at 11:13 AM

Hello, I am also facing the same issue.

For me this issue only occurs when running a vs 2010 compiled version of my program, vs 2008 works fine. My solutions have been generated by CMake and I use Qt for my program. side note: Before using CMake everything ran fine. Switching back isn't acceptable. FYI I am working on a Windows 7 x64 machine.

Does anyone have a better solution than using the full path to the dll? For now I can use the full path workaround.

Thanks,

Wouter