我的c#程序里动态调用了c++ dll, 用了两个回调函数;
程序在执行的时候经常报出这样的错误:Application Error: the instruction at'xxx 'referenced memory at 'xxx ', The memory could not be 'read', 非常奇怪,无法debug到,请问大家这是怎么回事?

解决方案 »

  1.   

    经常报错:Attempted to read or write protected memory. This is often an indication that other memory is corrupt
      

  2.   

    DLL函数引用有问题,把你那几个C++函数原型和你的申明贴出来吧。
      

  3.   

    c++
    AMC_RETURN WINAPI (DLL_EXP Mesg_Send)(USHORT usMesgID_, UCHAR ucMesgSrcDest_, UCHAR ucMesgSize_, UCHAR *pucMesg_, ULONG ulTimeOut_ = 0);
    c#
    public delegate AMC_RETURN Mesg_Send(ushort usMesgID_, byte ucMesgSrcDest_, byte ucMesgSize_, byte[] pucMesg_, uint ulTimeOut_);
      

  4.   

    byte[] pucMesg_
    前面加个[in,out]试试