在Release中构建时,函数返回空向量

时间:2017-02-11 01:48:05

标签: c++ vector release

这是功能:

std::vector<int> CTat964Drs::ExecuteMultiplePtgsWithStatus(int numberOfPatTimeGroups,
                                                           int *ptgHandle,
                                                           double Timeout,
                                                           int numTimeExecute,
                                                           T964DRS_BURST_COMPLETE Mode,
                                                           int numErrorsArr[],
                                                           bool burstTimeoutArr[])
{
    int i = 0;
    int numErrors = 0;
    bool burstTimeout = false;
    std::vector<int> multipleStatus;

    multipleStatus.resize(numberOfPatTimeGroups);

    for (i = 0; i < numberOfPatTimeGroups; i++)
    {
        if (!m_ptgArray || ptgHandle < 0 || !m_ptgArray[ptgHandle[i]])
        {
            multipleStatus[i] = DRS_ERRCD_INVALID_HANDLE;
            continue;
        }

        if (burstTimeoutArr != NULL)
        {
            // For this case, timeout is reported in burstTimeout. It is not reported in status.
            multipleStatus[i] = ((CTat964DrsPatTimeGrpPtr)(m_ptgArray[ptgHandle[i]]))->
                    ExecutePtg(Timeout, numTimeExecute, Mode, &numErrors, &burstTimeout);

            burstTimeoutArr[i] = burstTimeout;
        }
        else
        {
            // For this case, timeout is reported in status.
            multipleStatus[i] = ((CTat964DrsPatTimeGrpPtr)(m_ptgArray[ptgHandle[i]]))->
                    ExecutePtg(Timeout, numTimeExecute, Mode, &numErrors);
        }

        numErrorsArr[i] = numErrors;
    }

    return multipleStatus;
}

这是调用程序中的用法,它也是一个DLL。

std::vector<int> multipleStatus;

multipleStatus = m_T940->ExecuteMultiplePtgsWithStatus(m_PTGCount, 
                                                       _ptgHandles,
                                                       _maxTime,
                                                       _loopCnt,
                                                       T964DRS_SYNCHRONOUS,
                                                       numErrorsArr,
                                                       burstTimeoutArr)

当包含ExecuteMultiplePtgsWithStatus()的DLL在Debug配置中构建时,代码工作正常,但该函数在Release配置中构建时返回一个空向量。

有什么建议吗?

谢谢!

0 个答案:

没有答案