Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/08/18 17:10:53 (5 years ago)
Author:
ddorfmei
Message:

#2931:

  • added license information to all files
  • added missing storable and cloning constructors
  • fixed a bug that caused an exception when a Hive Slave tried to delete the files in the PluginTemp folder
Location:
branches/2931_OR-Tools_LP_MIP/HeuristicLab.ExtLibs/HeuristicLab.OrTools/6.9.0-pre/HeuristicLab.OrTools-6.9.0-pre
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.ExtLibs/HeuristicLab.OrTools/6.9.0-pre/HeuristicLab.OrTools-6.9.0-pre/Plugin.cs.frame

    r16233 r16288  
    2121
    2222using System;
     23using System.IO;
     24using System.Linq;
     25using System.Runtime.InteropServices;
    2326using HeuristicLab.PluginInfrastructure;
    2427
    2528namespace HeuristicLab.OrTools {
     29
    2630  [Plugin("HeuristicLab.OrTools", "Provides functionality of Google OR-Tools in HeuristicLab. Requires Windows 64-bit", "6.9.0.$WCREV$")]
    2731  [PluginFile("HeuristicLab.OrTools-6.9.0-pre.dll", PluginFileType.Assembly)]
     
    3034  [PluginFile("Google.OrTools.runtime.win-x64.dll", PluginFileType.NativeDll)]
    3135  [PluginFile("Google.OrTools_version.txt", PluginFileType.Data)]
     36  [PluginFile("Google.Protobuf.dll", PluginFileType.Assembly)]
    3237  [PluginFile("glpk_4_65.dll", PluginFileType.NativeDll)]
    3338  [PluginFile("glpk-license.txt", PluginFileType.License)]
    3439  public class HeuristicLabOrToolsPlugin : PluginBase {
     40
     41    ~HeuristicLabOrToolsPlugin() {
     42      OnUnload(); // HACK: remove once ticket #2961 is solved
     43    }
     44
     45    public override void OnUnload() {
     46      base.OnUnload();
     47
     48      var thisClass = typeof(HeuristicLabOrToolsPlugin);
     49      var dir = new FileInfo(thisClass.Assembly.Location).Directory;
     50      if (dir == null)
     51        return;
     52
     53      var nativeDlls = thisClass.GetCustomAttributes(typeof(PluginFileAttribute), true)
     54        .Cast<PluginFileAttribute>()
     55        .Where(pf => pf.FileType == PluginFileType.NativeDll)
     56        .Select(pf => pf.FileName);
     57
     58      foreach (var nativeDll in dir.EnumerateFiles().Where(f => nativeDlls.Contains(f.Name))) {
     59        var handle = LoadLibrary(nativeDll.FullName);
     60        if (handle == IntPtr.Zero)
     61          continue;
     62
     63        FreeLibrary(handle); // close handle obtained above
     64        FreeLibrary(handle); // close implicitly obtained handle
     65      }
     66    }
     67
     68    [DllImport("kernel32.dll", SetLastError = true)]
     69    [return: MarshalAs(UnmanagedType.Bool)]
     70    private static extern bool FreeLibrary(IntPtr hModule);
     71
     72    [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi)]
     73    private static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName);
    3574  }
    3675}
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.ExtLibs/HeuristicLab.OrTools/6.9.0-pre/HeuristicLab.OrTools-6.9.0-pre/Properties/AssemblyInfo.cs

    r16233 r16288  
    5454// [assembly: AssemblyVersion("1.0.*")]
    5555[assembly: AssemblyVersion("6.8.0.0")]
    56 [assembly: AssemblyFileVersion("6.8.0.16172")]
     56[assembly: AssemblyFileVersion("6.8.0.16233")]
Note: See TracChangeset for help on using the changeset viewer.