Win32API.cs 790 B

1234567891011121314151617181920212223242526
  1. using System.Diagnostics.Contracts;
  2. using System.Runtime.InteropServices;
  3. #pragma warning disable 1591
  4. #pragma warning disable CA1401 // P/Invokes should not be visible
  5. #pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments
  6. namespace OpenCvSharp.Internal;
  7. /// <summary>
  8. /// Win32API Wrapper
  9. /// </summary>
  10. public static class Win32Api
  11. {
  12. #if DOTNET_FRAMEWORK
  13. private const CharSet DefaultCharSet = CharSet.Auto;
  14. #else
  15. private const CharSet DefaultCharSet = CharSet.Unicode;
  16. #endif
  17. [Pure, DllImport("kernel32", CallingConvention = CallingConvention.Winapi,
  18. SetLastError = true, CharSet = DefaultCharSet, BestFitMapping = false, ThrowOnUnmappableChar = true)]
  19. public static extern IntPtr LoadLibrary(string dllPath);
  20. }