开发者

What happens when I DllImport a function that is not available on the runtime platform?

开发者 https://www.devze.com 2022-12-20 16:40 出处:网络
I previously asked, How to determine the target of a symbolic link or Reparse Point? ...and got an answer that suggested the use of the Win32 function GetFinalPathNameByHandle, a function first avail

I previously asked, How to determine the target of a symbolic link or Reparse Point? ...and got an answer that suggested the use of the Win32 function GetFinalPathNameByHandle, a function first available on Vista.

What happens if I build the .NET Assembly and then attempt to run it on WinXP, or WS2003,开发者_StackOverflow社区 which does not have the GetFinalPathNameByHandle function? Is there a runtime exception, and if so, which one? Is there a way for me to handle that case in the app code?


You'll get an EntryPointNotFoundException when you call the method.

If the entire DLL file doesn't exist, you'll get a DllNotFoundException instead.

0

精彩评论

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