예제 #1
0
    public void Register <T>() where T : ICallbackable
    {
        InitializeIfNeeded();

        var nativePointer = (void **)MemoryHelpers.AllocateMemory(PointerSize * _size);
        var offset        = 0;
        var pointers      = _pointers;

        for (int i = 0, count = pointers.Count; i < count; ++i)
        {
            var item   = pointers[i];
            var length = item.Length;
            item.CopyTo(new Span <IntPtr>(nativePointer + offset, length));
            offset += length;
        }

        TypeDataStorage.Register <T>(nativePointer);
        pointers.Clear();
        _size = 0;
    }
예제 #2
0
 public IntPtr Find <TCallback>() where TCallback : ICallbackable => Find(TypeDataStorage.GetGuid <TCallback>());