Did P/Invoke environment change in .NET 4.0?

前端 未结 4 2494
心在旅途
心在旅途 2021-02-19 15:17

I\'ve started upgrading a .NET 2.0 WinForms application to .NET 4.0. Well, OK, the upgrade process was just a matter of switching platform target, but making it actually work.

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 15:58

    Appears that this is a problem with the Calling Convention property in the DllImport attribute. Should be Cdecl not the default StdCall. I had this problem when migrating from 2.0 to 4.0 and running in VS2010. See article here. http://codenition.blogspot.com/2010/05/pinvokestackimbalance-in-net-40i-beg.html

提交回复
热议问题