Exemplo n.º 1
0
 public static void UnloadDynamicLibrary(SupportedPlatform platform, IntPtr handle)
 {
     if (platform != SupportedPlatform.Android)
     {
         throw new NotSupportedException();
     }
     if (NativeUnixMehods.dlclose(handle) != 0)
     {
         throw GetLastError() ?? new InvalidOperationException();
     }
 }
Exemplo n.º 2
0
    public static void UnloadDynamicLibrary(SupportedPlatform platform, IntPtr handle)
    {
        switch (platform)
        {
        case SupportedPlatform.Windows:
            if (NativeWindowsMethods.FreeLibrary(handle) == false)
            {
                throw GetLastWindowsError();
            }
            break;

        case SupportedPlatform.Linux:
        case SupportedPlatform.MacOSX:
            if (NativeUnixMehods.dlclose(handle) != 0)
            {
                throw GetLastErrorUnix() ?? new InvalidOperationException();
            }
            break;

        default: throw new NotSupportedException();
        }
    }