Example #1
0
 public void Dispose()
 {
     if (this.ptr != IntPtr.Zero)
     {
         MetacallAPI.metacall_value_destroy(this.ptr);
     }
 }
Example #2
0
        public ExecutionResult Invoke(string function, params object[] args)
        {
            List <IntPtr> metacallArgs = new List <IntPtr>(args.Length);

            foreach (var arg in args)
            {
                metacallArgs.Add(primitiveToIntPtr[arg.GetType()](arg));
            }

            IntPtr ptr = MetacallAPI.metacallv(function, metacallArgs.ToArray());

            return(ExecutionResult.Make(ptr));
        }
Example #3
0
        public IFunction GetFuntion(string name)
        {
            IntPtr    pointer = IntPtr.Zero;
            IFunction result  = null;

            pointer = MetacallAPI.metacall_function(name);

            if (pointer != IntPtr.Zero)
            {
                result = new Function(this, pointer);
            }

            return(result);
        }
Example #4
0
 public bool HasFunction(string name)
 {
     return(MetacallAPI.metacall_function(name) != IntPtr.Zero);
 }
Example #5
0
        public bool LoadScriptFromFile(string tag, params string[] files)
        {
            var ff = files.Select(x => Marshal.StringToHGlobalAnsi(x)).ToArray();

            return(MetacallAPI.metacall_load_from_file(tag, ff, (long)files.Length) == 0);
        }
Example #6
0
 static Metacall()
 {
     MetacallAPI.metacall_initialize();
 }