private static Xerbla xerblaCallbackReferenceToStopItBeingGarbageCollected; // useful ? /// <param name="max">The max number of threads to use</param> public DynMklMlLinux(int max = -1) { xerblaCallbackReferenceToStopItBeingGarbageCollected = ErrorHandler; mkl_set_xerbla(xerblaCallbackReferenceToStopItBeingGarbageCollected); if (max > 0) { SetNumThreads(max); } }
private static Xerbla xerblaCallbackReferenceToStopItBeingGarbageCollected; // useful ? /// <param name="max">The max number of threads to use</param> /// <param name="path"> /// This string is prepended to the path environment variable. /// Allows to find the needed dll. /// </param> public DynMklRtWindows(int max = -1, string path = null) { if (path != null) { var globalPath = Environment.GetEnvironmentVariable("PATH"); globalPath = string.Concat(Path.GetFullPath(path), ";", globalPath); Environment.SetEnvironmentVariable("PATH", globalPath, EnvironmentVariableTarget.Process); } xerblaCallbackReferenceToStopItBeingGarbageCollected = ErrorHandler; mkl_set_xerbla(xerblaCallbackReferenceToStopItBeingGarbageCollected); if (max > 0) { SetNumThreads(max); } }
static extern IntPtr mkl_set_xerbla(Xerbla x); // do not try to unmarshal return value => wrong appdomain exception