public unsafe QuicApi() { NativeQuicApi *nativeApi = null; int status = QuicNativeMethods.MsQuicOpen(&nativeApi); if (status != 0) { Marshal.ThrowExceptionForHR(status); m_nativeApi = null !; return; } m_nativeApi = ApiGenerator.CreateApiImplementation(nativeApi, QuicNativeMethods.MsQuicClose); }
// This API will be replaced with Function Pointers once they exist, but for now IL generation is by far the // fastest way to generate the QUIC api public unsafe static IQuicInteropApi CreateApiImplementation(NativeQuicApi *api, QuicCloseDelegate closeDelegate) { var constructor = s_apiConstructor.Value; return((IQuicInteropApi)constructor.Invoke(new object[] { Pointer.Box(api, typeof(NativeQuicApi *)), closeDelegate })); }
public static unsafe extern void MsQuicClose(NativeQuicApi *api);