ATL problem

  • Thread starter Thread starter Maxim
  • Start date Start date
M

Maxim

Hi all,

I'm trying to use ATL (CString, CCOMSafeArray, etc.) classes in managed C++
code, but I get the following assert exeption when I start the application:

Debug Assertion Failed:

Expression: _CrtIsValidHeapPointer(pUserData)

in file dbgheap.c

......................
/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.
*/
_ASSERTE(_CrtIsValidHeapPointer(pUserData));
......................

I've found that this problems appears when I use ATL classes. Without them
the code works fine.

Can anybody help me with this?

Thanks in advance
 
Maxim said:
I'm trying to use ATL (CString, CCOMSafeArray, etc.) classes in managed
C++

Managed Extensions for C++ in VS2003 and not the managed version of C++ in
VS2005 called C++/CLI?
code, but I get the following assert exeption when I start the
application:

Debug Assertion Failed:

Expression: _CrtIsValidHeapPointer(pUserData)

in file dbgheap.c

If you are using VS2003 it is most likely the mixed-mode / loader-lock
issue. See here:

http://support.microsoft.com/?id=814472

http://msdn.microsoft.com/msdnmag/issues/06/06/CAtWork/

If it is 2005 that you are using, please say so. Someone will probably offer
another solution.

Regards,
Will
www.ivrforbeginners.com
 
Thanks for reply, William.

Sorry I'm new to all this managed stuff. I'm using VC2005. So it would be
C++/CLI.
 
Maxim said:
Thanks for reply, William.

You are welcome.
Sorry I'm new to all this managed stuff.

No need to be sorry.
I'm using VC2005. So it would be C++/CLI.

Then I'm sorry to say I don't know what the problem is. In the second link I
posted, the author reported a similar assertion in code he wrote. He said
his problem was that he mistakenly linked with the /NOENTRY switch. You
didn't do that, did you?

Regards,
Will
www.ivrforbeginners.com
 
Back
Top