M
marat
I have a managed c++ function below that makes a call to an unmanaged c++ dll
.. This function is called from a C# app, resulting in a
"Debug Assertion Failed dbgdel.cpp Line 52
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)" errir message.
This happens on function exit, looks like related to destruction of some vector.
Any ideas why ????
ArrayList*
NM::doSomething(ArrayList* anchorStrikesList,
ArrayList* anchorVolsList,
ArrayList* allStrikesList
{
vector<double> anchorStrikesVec, anchorVolsVec, allStrikesVec, allVolsVec;
////// convert to vectors ////
for (int i = 0; i < anchorStrikesList->Count; ++i)
{
double val = *dynamic_cast<double __gc *>(anchorStrikesList->get_Item(i));
anchorStrikesVec.push_back(val);
}
for (i = 0; i < anchorVolsList->Count; ++i)
{
double val = *dynamic_cast<double __gc *>(anchorVolsList->get_Item(i));
anchorVolsVec.push_back(val);
}
for (i = 0; i < allStrikesList->Count; ++i)
{
double val = *dynamic_cast<double __gc *>(allStrikesList->get_Item(i));
allStrikesVec.push_back(val);
}
// unmanaged c++ dll call
foo(anchorStrikesVec, anchorVolsVec, allStrikesVec, allVolsVec);
// Convert back to vector of computed vols and return
ArrayList* allVolsList = new ArrayList();
for (i = 0; i < allVolsVec.size(); ++i)
{
double vol = allVolsVec;
allVolsList->Add(__box(vol));
}
return allVolsList;
}
.. This function is called from a C# app, resulting in a
"Debug Assertion Failed dbgdel.cpp Line 52
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)" errir message.
This happens on function exit, looks like related to destruction of some vector.
Any ideas why ????
ArrayList*
NM::doSomething(ArrayList* anchorStrikesList,
ArrayList* anchorVolsList,
ArrayList* allStrikesList
{
vector<double> anchorStrikesVec, anchorVolsVec, allStrikesVec, allVolsVec;
////// convert to vectors ////
for (int i = 0; i < anchorStrikesList->Count; ++i)
{
double val = *dynamic_cast<double __gc *>(anchorStrikesList->get_Item(i));
anchorStrikesVec.push_back(val);
}
for (i = 0; i < anchorVolsList->Count; ++i)
{
double val = *dynamic_cast<double __gc *>(anchorVolsList->get_Item(i));
anchorVolsVec.push_back(val);
}
for (i = 0; i < allStrikesList->Count; ++i)
{
double val = *dynamic_cast<double __gc *>(allStrikesList->get_Item(i));
allStrikesVec.push_back(val);
}
// unmanaged c++ dll call
foo(anchorStrikesVec, anchorVolsVec, allStrikesVec, allVolsVec);
// Convert back to vector of computed vols and return
ArrayList* allVolsList = new ArrayList();
for (i = 0; i < allVolsVec.size(); ++i)
{
double vol = allVolsVec;
allVolsList->Add(__box(vol));
}
return allVolsList;
}