开发者

What's the difference between MethodHandle.GetFunctionPointer and Marshal.GetFunctionPointerForDelegate

开发者 https://www.devze.com 2023-01-23 18:20 出处:网络
as stated above I need to know what the difference is between this two possibilities when trying to pass a delegate as a callback to a native DLL. I sometimes have to use the first one and sometimes t

as stated above I need to know what the difference is between this two possibilities when trying to pass a delegate as a callback to a native DLL. I sometimes have to use the first one and sometimes the second one for my code to work. However, it is unclear to me what's the difference and when to use which possibi开发者_运维技巧lity.

Please enlighten me ;)


To my knowledge, MethodHandle.GetFunctionPointer would be used when you have a MethodInfo object to start with. GetFunctionPointerForDelegate, on the other hand, would be used when you have a delegate to begin with.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号