public static void RegisterMathLinkFactory (string dir_ml64_dll = @"C:\Program Files\Wolfram Research\Mathematica\11.3\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\SystemAdditions\" ) { HMathLinkFactory.RegisterMathLinkFactory (dir_ml64_dll ); }
public static KernelLinkDelegate CreateKernelLinkDelegate() { IKernelLink ml = HMathLinkFactory.CreateKernelLink(); ml.WaitAndDiscardAnswer(); return(new KernelLinkDelegate { ml = ml, }); }
public static T Evaluate <T>(string evaluate, Func <IKernelLink, T> GetT) { IKernelLink ml = HMathLinkFactory.CreateKernelLink(); ml.WaitAndDiscardAnswer(); ml.Evaluate(evaluate); ml.WaitForAnswer(); T result; try { result = GetT(ml); //result = ml.GetDoubleArray(); //result = ml.GetObject(); } catch { result = default(T); //result = null; } ml.Close(); return(result); }