Hi,

I passed the CStringArray to dll & wrote the String in a file.

The error File: array_s.cpp, Line No: 420 was occured when i close the .exe file.

For your reference:

Code:
Function Declaration in DLL :

DECLDIR void SetParName(CStringArray& ParName); 

Function Definition in DLL : 

DECLDIR void SetParName(CStringArray& ParName)

{ 

ParName.Add("X1");

ParName.Add("X2"); 

}

Calling Function in Application :

Code:
CStringArray ParName;

if(_SetParNameFunc)

{ 

_SetParNameFunc(ParName); //Function Called Using CStringArray

char a[10];

int size=ParName.GetSize();

itoa(size,a,10);

::AfxMessageBox(a);

CStdioFile file;

CString strTemp;

file.Open("ParName.txt",CFile::modeCreate|CFile::modeWrite); 

for(int i=0;i<size;i++)

{

strTemp=ParName.GetAt(i);

file.WriteString(strTemp+"\n");

} 

file.Close(); 

}
ERROR :

File : array_s.cpp

Line : 420

array_s.cpp
-----------------------

void CStringArray::AssertValid() const
{
CObject::AssertValid();

if (m_pData == NULL)
{
ASSERT(m_nSize == 0);
ASSERT(m_nMaxSize == 0);
}

else
{
ASSERT(m_nSize >= 0);
ASSERT(m_nMaxSize >= 0);
ASSERT(m_nSize <= m_nMaxSize);

ASSERT(AfxIsValidAddress(m_pData, m_nMaxSize * sizeof(CString))); //Line : 420

}
}
My doubt is, CStringArray items are allocated in the DLL. So, when i release the CStringArray object in the application.

Is it can release memory that are allocated in the DLL ?