/// <summary>
        /// Load a native interface
        /// </summary>
        /// <returns></returns>
        public object?LoadNativeInterface(Type t)
        {
            if (!t.IsInterface)
            {
                throw new InvalidOperationException($"{t.Name} must be an interface");
            }

            if (LibraryLoader == null)
            {
                throw new InvalidOperationException("A native library is not already loaded");
            }

            var ilGenerator        = new CalliILGenerator();
            var interfaceGenerator = new InterfaceGenerator(LibraryLoader, ilGenerator);

            return(interfaceGenerator.GenerateImplementation(t));
        }
        /// <summary>
        /// Load a native interface
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public T?LoadNativeInterface <T>() where T : class
        {
            if (!typeof(T).IsInterface)
            {
                throw new InvalidOperationException($"{typeof(T).Name} must be an interface");
            }

            if (LibraryLoader == null)
            {
                throw new InvalidOperationException("A native library is not already loaded");
            }

            var ilGenerator        = new CalliILGenerator();
            var interfaceGenerator = new InterfaceGenerator(LibraryLoader, ilGenerator);

            return(interfaceGenerator.GenerateImplementation <T>());
        }