DLL求救
大虾请帮忙看此程序。谢谢!
DLL文件:
...
struct Fond
{
LPBYTE FAR* ppbyLine;
...
};
extern "C" __declspec(dllexport) int Test(Fond *fond,int n)
{
for(int i=0;i<n;i++)
{
fond[i].ppbyLine=new LPBYTE FAR[3];
fond[i].ppbyLine[0]=new BYTE[3*4];
for(int j=0;j<3;j++)
fond[i].ppbyLine[j]=fond[i].ppbyLine[0]+4*j;
}
return 0;
}
....
调用文件:
...
Fond fond[5];
Test(fond,5);
for(int i=0;i<5;i++)
{
delete[] fond[i].ppbyLine[0];
delete[] fond[i].ppbyLine;
}
当i=4即最后一次循环时,VC总是弹出Debug Assertion Failed!
其assert语句为 _pFirstBlock==pHead
当我不用DLL而是直接实现时,却没问题。我找了半天都没有找到问题,
请问这是为什么?