Hello All,
Good day.
I'm new to C# and trying to call functions from a DLL (C++ ObjGen). I'm getting this message and can't figure out why. Here's the code:
object[] objID = new object[] { ID };
ObjGen.Invoke(InvokeEnum.Query_State, objID);
Dll code
///////////////////////
INVOKE_FUNC_IMPLEMENT(Query_State, CUtil::GetState)
///////////////////////
bool CUtil::GetState(InvokeEnum methodID, SAFEARRAY * psa)
{
UNIT_ID UID = (UNIT_ID)PARAM_LONG(0);
CUtil::Instance()->NotifyUpdateState(UID);
for(int slot = 0; slot < SLOT_ID_MAX; slot++)
g_CManager.m_PJAssociArray[UID][slot] = 0;
return true;
}
There is a loop called the top Invoke function. When objID = 1 Or 2 Or 3, the function worked very well. But when objID = 4. the function exception.
What could be the reason? Issue in C# or Dll file?
Is there something error in the Instance() OR NotifyUpdateState() ? i can't do the judgement.
thank you.