private void InternalJoin(Delegate callback, object state) { if (callback == null) { throw new ArgumentNullException("callback"); } IntPtr ptr = MarshalAs.ObjectToIUnknown(state); nsjs_virtualmachine_join(this.Handle, NSJSFunction.DelegateToFunctionPtr(callback), ptr); }
public static NSJSVirtualMachine From(IntPtr handle) { if (handle == NULL) { return(null); } NSJSVirtualMachine machine; if (machines.TryGetValue(handle, out machine)) { return(machine); } return(MarshalAs.CookieToObject(handle) as NSJSVirtualMachine); }
public object MarshalNativeToManaged(IntPtr pNativeData) { if (pNativeData == NULL) { return(null); } if (this.kind == MarshalAsKind.kStateObject) { return(MarshalAs.IUnknownToObject(pNativeData)); } if (this.kind == MarshalAsKind.kVirtualMachine) { return(NSJSVirtualMachine.From(pNativeData)); } return(null); }
public virtual T GetData <T>(int solt) { IntPtr p = this.GetData(solt); if (typeof(T) == typeof(IntPtr)) { return((T)(object)p); } object obj = MarshalAs.IUnknownToObject(p); if (obj == null || !typeof(T).IsInstanceOfType(obj)) { return(default(T)); } return((T)obj); }
public IntPtr MarshalManagedToNative(object ManagedObj) { if (ManagedObj == null) { return(NULL); } if (this.kind == MarshalAsKind.kVirtualMachine) { NSJSVirtualMachine machine = ManagedObj as NSJSVirtualMachine; if (machine == null) { return(NULL); } return(machine.Isolate); } else if (this.kind == MarshalAsKind.kStateObject) { return(MarshalAs.ObjectToIUnknown(ManagedObj)); } return(NULL); }
public static T FunctionPtrToDelegate <T>(IntPtr ptr) { return(MarshalAs.FunctionPtrToDelegate <T>(ptr)); }
public static IntPtr DelegateToFunctionPtr(Delegate d) { return(MarshalAs.DelegateToFunctionPtr(d)); }
public unsafe static extern void CopyMemory([Out] void *dest, [In] void *src, #if WIN64 [In, MarshalAs(UnmanagedType.U8)] ulong #else [In, MarshalAs(UnmanagedType.U4)] uint
public virtual void SetData(int solt, object value) { this.SetData(solt, MarshalAs.ObjectToIUnknown(value)); }