回调函数是把地址做为参数 那么在静态方法里 可以保证
如果在别的地方调用 如何保证回调的地址
比如  鼠标点击事件

解决方案 »

  1.   

    http://www.codeproject.com/dotnet/Cdecl_CSharp_VB.asp
      

  2.   

    楼主能不能说详细点:要作些什么?一般情况下用Invoke应该可以达到目的了
      

  3.   

    自己顶 
    就是在用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.
      

  4.   

    http://www.findarticles.com/p/articles/mi_zddvs/is_200410/ai_n7181699/pg_3
      

  5.   

    .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