自己顶 就是在用delegate同时有CallBack 如何在invoke的时候保证CallBack的地址是唯一的 不然会出现The problem is that the function pointer that the unmanaged function accepts should respect the C calling convention but the delegate instance you pass to it does not (it respects the standard calling convention (__stdcall). As a result, after the first call of the method from unmanaged code, the stack becomes corrupted and on the second or third call, a System.NullReferenceException is thrown.
.method public hidebysig virtual instance native int modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl) Invoke(int32 cb) runtime managed { } // end of method FdiMemAllocDelegate::InvokeAutomating the Changes
就是在用delegate同时有CallBack 如何在invoke的时候保证CallBack的地址是唯一的
不然会出现The problem is that the function pointer that the unmanaged function accepts should respect the C calling convention but the delegate instance you pass to it does not (it respects the standard calling convention (__stdcall). As a result, after the first call of the method from unmanaged code, the stack becomes corrupted and on the second or third call, a System.NullReferenceException is thrown.
modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl)
Invoke(int32 cb) runtime managed
{
} // end of method FdiMemAllocDelegate::InvokeAutomating the Changes