Example #1
0
        public void Eval(string chunk, string chunkName = "chunk")
        {
            IntPtr resultInfo = PuertsDLL.Eval(isolate, chunk, chunkName);

            if (resultInfo == IntPtr.Zero)
            {
                string exceptionInfo = PuertsDLL.GetLastExceptionInfo(isolate);
                throw new Exception(exceptionInfo);
            }
            PuertsDLL.ResetResult(resultInfo);
        }
Example #2
0
        public TResult Eval <TResult>(string chunk, string chunkName = "chunk")
        {
            IntPtr resultInfo = PuertsDLL.Eval(isolate, chunk, chunkName);

            if (resultInfo == IntPtr.Zero)
            {
                string exceptionInfo = PuertsDLL.GetLastExceptionInfo(isolate);
                throw new Exception(exceptionInfo);
            }
            TResult result = StaticTranslate <TResult> .Get(Idx, isolate, NativeValueApi.GetValueFromResult, resultInfo, false);

            PuertsDLL.ResetResult(resultInfo);
            return(result);
        }