public static SymbolicExpression ExecFunction(this REngine engine, SymbolicExpressionParamList expressionParams, string functionName) { var paramValue = engine.GetFunction(expressionParams); var function = $"{functionName}({paramValue})"; return(engine.Evaluate(function)); }
public static SymbolicExpression ToExternalPointer(REngine engine, object instance) { if (instance == null) { return(engine.NilValue); } var tag = engine.CreateCharacterVector(new[] { NET_OBJ_TAG, instance.GetType().FullName }); var ptr = engine.GetFunction <R_MakeExternalPtr>()( Marshal.GetIUnknownForObject(instance), tag.DangerousGetHandle(), engine.NilValue.DangerousGetHandle()); var sexp = engine.CreateFromNativeSexp(ptr); return(sexp); }
public static void Release(REngine engine, IntPtr pointer) { var objPtr = engine.GetFunction <R_ExternalPtrAddr>()(pointer); Marshal.Release(objPtr); }