c# - Simply declaring a function signature from an external DLL does not give a runtime exception if the DLL or function doesn't exist, right? -
for example, if i'm declaring:
internal static class winapi { [dllimport("dwmapi.dll", preservesig = false)] internal static extern bool dwmiscompositionenabled(); }
but i'm not calling dwmiscompositionenabled function in project, hope not raise exception when running program on systems dwmapi.dll not exist (or function not exist in dll). (real case: dwmapi.dll requires windows vista, doesn't exist on windows xp).
this problem if , when api called.
you consider thin c# wrapper on p/invoke facilitate handling error, if call multiple places.
Comments
Post a Comment