private static IntPtr GetFunctionPointer(IntPtr nativeLibraryHandle, string functionName) { #if NET45 switch (LibraryLoader.GetPlatformId()) { case PlatformID.MacOSX: return(MacNativeMethods.dlsym(nativeLibraryHandle, functionName)); case PlatformID.Unix: return(LinuxNativeMethods.dlsym(nativeLibraryHandle, functionName)); case PlatformID.Win32NT: case PlatformID.Win32S: case PlatformID.Win32Windows: return(WindowsNativeMethods.GetProcAddress(nativeLibraryHandle, functionName)); default: throw new PlatformNotSupportedException(); } #else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { return(LinuxNativeMethods.dlsym(nativeLibraryHandle, functionName)); } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return(MacNativeMethods.dlsym(nativeLibraryHandle, functionName)); } if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(WindowsNativeMethods.GetProcAddress(nativeLibraryHandle, functionName)); } throw new PlatformNotSupportedException(); #endif }
private static IntPtr GetFunctionPointer(IntPtr nativeLibraryHandle, string functionName) { #if NET45 || NET40 return(WindowsNativeMethods.GetProcAddress(nativeLibraryHandle, functionName)); #else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { return(LinuxNativeMethods.dlsym(nativeLibraryHandle, functionName)); } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return(MacNativeMethods.dlsym(nativeLibraryHandle, functionName)); } if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(WindowsNativeMethods.GetProcAddress(nativeLibraryHandle, functionName)); } throw new PlatformNotSupportedException(); #endif }
private static IntPtr GetFunctionPointer(IntPtr nativeLibraryHandle, string functionName) { #if NET45 return(WindowsNativeMethods.GetProcAddress(nativeLibraryHandle, functionName)); #else switch (ffmpeg.GetPlatform()) { case FFMpegPlatform.macOS: return(MacNativeMethods.dlsym(nativeLibraryHandle, functionName)); case FFMpegPlatform.iOS: return(iOSNativeMethods.dlsym(nativeLibraryHandle, functionName)); case FFMpegPlatform.windows: return(WindowsNativeMethods.GetProcAddress(nativeLibraryHandle, functionName)); case FFMpegPlatform.unix: return(LinuxNativeMethods.dlsym(nativeLibraryHandle, functionName)); } throw new PlatformNotSupportedException(); #endif }