Why am I getting access violations using SafeArrays of more than one dimension?

By: mykle hoban

Abstract: How to remove the error in the C++Builder header files to fix this problem.

Question

Why is my SafeArray giving me access violations?

Answer

TSafeArrayT does not currently support multi-dimensional arrays. This problem is easily fixed by modifying the class's destructor in the safearry.h file.

change:to:

~TSAAccessorT()
{
  if (m_Alloc)
    delete[] m_Indices;
}

~TSAAccessorT()
{
  if (m_Alloc) {
    m_Indices--;
    delete[] m_Indices;
  }
}


Server Response from: ETNASC03