Debug heap corruption: Is there a version of cudart.lib that is compatible with msvcrtd.lib?

I am building a HelloWorld-style CUDA application (saxpy) on Windows 7 using VS2010 as a test.

I would like to link my debug build against the C-runtime debug library. However, this seems to be fundamentally incompatible with cudart.lib; which, if I understand correctly, is statically linked against the non-debug C-runtime library.

The program runs correctly but produces a heap corruption assertion failure during the debug version’s application exit (after the final return from main).

Is there a version of cudart.lib that is linked against msvcrtd.lib on Windows 7? If not, will there be one in future CUDA releases?

Well, I was able to work this out; so, I thought I’d share for posterity.

Turns out my first understanding (posted in OP) was wrong. I’m using nvcc to generate a .cpp from a .cu using the nvcc -cuda flag and then compiling that .cpp with my own cl and link calls. The first step performed by nvcc executes C++ pre-processing. I was not passing the flags like ‘-D_DEBUG’, etc., that I give cl for my .cpp’s through nvcc in my .cu -> .cpp pre-compile step. So, the pre-processing done by nvcc – which inlines #includes, among other things – was not inlining ‘crtdbg.h’.

This oversight on my part eventually created my heap corruption assertion failure for the example program ‘myheapbug.cu’:
#include
void main() { std::cout << “Hello, world!\n”; }

Hope this post helps someone else someday. Cheers.