I have a C++ DLL which is called from a C# GUI. I know that part of it works. Where I'm getting "stuck" is when I try to fill in some data to a class member which is a structure. I keep getting hit with ...
"Object reference not set to an instance of an object."
My class looks like this ....
class CNmsOperator
{
public:
CNmsOperator(void);
void Oper_CallOper (int oper, bool reserve) ;
void Oper_RecvOper (MSG_JOB_DATA * pOprMsg) ;
bool getOperInfo () { return (OperInfo); }
private:
OPERATOR_INFO m_OperInfoObj ;
volatile JOB_INDEX_RECORD * OperKey ;
bool OperInfo ;
// TODO: add your methods here.
};
In my CPP file I declare the following ...
static JOB_INDEX_RECORD volatile GOperKey ;
/* Class Constructor ... */
CNmsOperator::CNmsOperator(void)
{
OperKey = &GOperKey ;
}
/* And the function I'm touching OperKey ... */
void CNmsOperator::Oper_CallOper (int oper, bool reserve)
{
OperInfo = false ;
ZERO (OperKey) ;
ICN_1ST_PART(OperKey->icn) = ICN_OPERATOR_PREFIX ;
if (oper != OP_DEFAULT_NEW_DB_OP)
{
ICN_2ND_PART(OperKey->icn) = oper % 100000 ;
}
else
{
ICN_2ND_PART(OperKey->icn) = oper ;
}
OperKey->headslip = 0 ;
OperKey->record_type = J_OPERATOR_INFO ;
OperKey->piece = 0 ;
OperKey->anything = reserve ;
// TODO:
NmsMsg_ProcessSend ((JOB_INDEX_RECORD *)OperKey, NmsOper_RecvOper) ;
//NmsMsg_ProcessSend (&OperKey, NmsOper_RecvOper) ;
}
I'm getting the exception as soon as I start toughing OperKey in function Oper_CallOper.
Any ideas/suggestions/recommendations would be appreciated. I'm stumped on this one.
Thanks in advance!
"Object reference not set to an instance of an object."
My class looks like this ....
class CNmsOperator
{
public:
CNmsOperator(void);
void Oper_CallOper (int oper, bool reserve) ;
void Oper_RecvOper (MSG_JOB_DATA * pOprMsg) ;
bool getOperInfo () { return (OperInfo); }
private:
OPERATOR_INFO m_OperInfoObj ;
volatile JOB_INDEX_RECORD * OperKey ;
bool OperInfo ;
// TODO: add your methods here.
};
In my CPP file I declare the following ...
static JOB_INDEX_RECORD volatile GOperKey ;
/* Class Constructor ... */
CNmsOperator::CNmsOperator(void)
{
OperKey = &GOperKey ;
}
/* And the function I'm touching OperKey ... */
void CNmsOperator::Oper_CallOper (int oper, bool reserve)
{
OperInfo = false ;
ZERO (OperKey) ;
ICN_1ST_PART(OperKey->icn) = ICN_OPERATOR_PREFIX ;
if (oper != OP_DEFAULT_NEW_DB_OP)
{
ICN_2ND_PART(OperKey->icn) = oper % 100000 ;
}
else
{
ICN_2ND_PART(OperKey->icn) = oper ;
}
OperKey->headslip = 0 ;
OperKey->record_type = J_OPERATOR_INFO ;
OperKey->piece = 0 ;
OperKey->anything = reserve ;
// TODO:
NmsMsg_ProcessSend ((JOB_INDEX_RECORD *)OperKey, NmsOper_RecvOper) ;
//NmsMsg_ProcessSend (&OperKey, NmsOper_RecvOper) ;
}
I'm getting the exception as soon as I start toughing OperKey in function Oper_CallOper.
Any ideas/suggestions/recommendations would be appreciated. I'm stumped on this one.
Thanks in advance!