Exemplo n.º 1
0
        // Register CB function that takes a C# object as userdata
        public void RegisterRemovalCB(RemovalCbFunc cb, object data)
        {
            // Free existing GCHandle (if exists)
            if (hRemUserData.IsAllocated && hRemUserData.Target != null)
            {
                hRemUserData.Free();
            }

            // Convert object to pointer
            hRemUserData = GCHandle.Alloc(data);

            // Apply the user-defined CB function
            UserRemCB = new RemovalCbFunc(cb);
            wrf       = new WrapRemovalCbFunc(WrapperRemCB);

            _RegisterRemovalCB(wrf, (IntPtr)hRemUserData);
        }
Exemplo n.º 2
0
        // Register CB function that takes a C# object as userdata
        public void RegisterRemovalCB(RemovalCbFunc cb, object data)
        {
            // Free existing GCHandle (if exists)
            if (hRemUserData.IsAllocated && hRemUserData.Target != null)
                hRemUserData.Free();

            // Convert object to pointer
            hRemUserData = GCHandle.Alloc(data);

            // Apply the user-defined CB function          
            UserRemCB = new RemovalCbFunc(cb);
            wrf = new WrapRemovalCbFunc(WrapperRemCB);

            _RegisterRemovalCB(wrf, (IntPtr)hRemUserData);
        }