S
skg
I have an application using managed extension for C++ which calls a
function in a dll written in C.
That function initializes a character pointer passed to it..
char *pfNamesList = NULL;
InitializeNames(pfNamesList ); // Allocates memory using malloc and
initilaizes the pointer to it.
System::IntPtr target = pfNamesList ;
String* szFileList = Marshal:trToStringAnsi(target);
System::IntPtr target = Marshal::ReadIntPtr(pAttNamesList);
Marshal::FreeCoTaskMem(target); //Frees any kind of allcated memory
After running the above code in a loop for 20-30 times I get following
error.
"Unhandled exception at 0x7c901230" and debugger goes to dbgheap.c
can any one suggest what iam doing wrong.
Thanks!!!
function in a dll written in C.
That function initializes a character pointer passed to it..
char *pfNamesList = NULL;
InitializeNames(pfNamesList ); // Allocates memory using malloc and
initilaizes the pointer to it.
System::IntPtr target = pfNamesList ;
String* szFileList = Marshal:trToStringAnsi(target);
System::IntPtr target = Marshal::ReadIntPtr(pAttNamesList);
Marshal::FreeCoTaskMem(target); //Frees any kind of allcated memory
After running the above code in a loop for 20-30 times I get following
error.
"Unhandled exception at 0x7c901230" and debugger goes to dbgheap.c
can any one suggest what iam doing wrong.
Thanks!!!