Beispiel #1
0
        // callback wrappers
        public static IObjectBase _IP2Obj(IntPtr varobj, bool freehandle = false)
        {
            IntPtr      handleP = Marshal.ReadIntPtr(varobj, NI.VarObj.offsetOfData);
            IObjectBase obj     = (IObjectBase)HDL.GetObj(handleP);

            if (freehandle)
            {
                HDL.Free(handleP);
            }
            return(obj);
        }
Beispiel #2
0
 public void DisownClassObject()
 {
     if (_sgsObject == IntPtr.Zero)
     {
         throw new SGSException(RC.EINPROC, "FreeClassObject - object is not allocated");
     }
     Marshal.WriteIntPtr(_sgsObject, NI.VarObj.offsetOfIface, _sgsNullObjectInterface);
     HDL.Free(Marshal.ReadIntPtr(_sgsObject, NI.VarObj.offsetOfData));
     Marshal.WriteIntPtr(_sgsObject, NI.VarObj.offsetOfData, IntPtr.Zero);
     FreeClassObject();
 }
Beispiel #3
0
        public void AllocClassObject()
        {
            if (_sgsObject != IntPtr.Zero)
            {
                throw new SGSException(RC.EINPROC, "AllocClassObject - object is already allocated");
            }
            IntPtr iface = GetClassInterface();

            NI.Variable var;
            NI.CreateObject(_sgsEngine.ctx, HDL.Alloc(this), iface, out var);
            _sgsObject = var.data.O;

            _InitMetaObject();
        }
Beispiel #4
0
 public static IObjectBase GetFromObjData(IntPtr objdata)
 {
     return((IObjectBase)HDL.GetObj(objdata));
 }