internal static void Bind(NativeLibrary nativeLibrary) { Library.yepLibrary_Init = (yepLibrary_Init_Delegate)nativeLibrary.GetFunction("yepLibrary_Init", typeof(yepLibrary_Init_Delegate)); Library.yepLibrary_Release = (yepLibrary_Release_Delegate)nativeLibrary.GetFunction("yepLibrary_Release", typeof(yepLibrary_Release_Delegate)); Library.yepLibrary_GetVersion = (yepLibrary_GetVersion_Delegate)nativeLibrary.GetFunction("yepLibrary_GetVersion", typeof(yepLibrary_GetVersion_Delegate)); Library.yepLibrary_GetCpuIsaFeatures = (yepLibrary_GetCpuIsaFeatures_Delegate)nativeLibrary.GetFunction("yepLibrary_GetCpuIsaFeatures", typeof(yepLibrary_GetCpuIsaFeatures_Delegate)); Library.yepLibrary_GetCpuSimdFeatures = (yepLibrary_GetCpuSimdFeatures_Delegate)nativeLibrary.GetFunction("yepLibrary_GetCpuSimdFeatures", typeof(yepLibrary_GetCpuSimdFeatures_Delegate)); Library.yepLibrary_GetCpuSystemFeatures = (yepLibrary_GetCpuSystemFeatures_Delegate)nativeLibrary.GetFunction("yepLibrary_GetCpuSystemFeatures", typeof(yepLibrary_GetCpuSystemFeatures_Delegate)); Library.yepLibrary_GetCpuVendor = (yepLibrary_GetCpuVendor_Delegate)nativeLibrary.GetFunction("yepLibrary_GetCpuVendor", typeof(yepLibrary_GetCpuVendor_Delegate)); Library.yepLibrary_GetCpuArchitecture = (yepLibrary_GetCpuArchitecture_Delegate)nativeLibrary.GetFunction("yepLibrary_GetCpuArchitecture", typeof(yepLibrary_GetCpuArchitecture_Delegate)); Library.yepLibrary_GetCpuMicroarchitecture = (yepLibrary_GetCpuMicroarchitecture_Delegate)nativeLibrary.GetFunction("yepLibrary_GetCpuMicroarchitecture", typeof(yepLibrary_GetCpuMicroarchitecture_Delegate)); Library.yepLibrary_GetCpuCyclesAcquire = (yepLibrary_GetCpuCyclesAcquire_Delegate)nativeLibrary.GetFunction("yepLibrary_GetCpuCyclesAcquire", typeof(yepLibrary_GetCpuCyclesAcquire_Delegate)); Library.yepLibrary_GetCpuCyclesRelease = (yepLibrary_GetCpuCyclesRelease_Delegate)nativeLibrary.GetFunction("yepLibrary_GetCpuCyclesRelease", typeof(yepLibrary_GetCpuCyclesRelease_Delegate)); Library.yepLibrary_GetTimerTicks = (yepLibrary_GetTimerTicks_Delegate)nativeLibrary.GetFunction("yepLibrary_GetTimerTicks", typeof(yepLibrary_GetTimerTicks_Delegate)); Library.yepLibrary_GetTimerFrequency = (yepLibrary_GetTimerFrequency_Delegate)nativeLibrary.GetFunction("yepLibrary_GetTimerFrequency", typeof(yepLibrary_GetTimerFrequency_Delegate)); Library.yepLibrary_GetTimerAccuracy = (yepLibrary_GetTimerAccuracy_Delegate)nativeLibrary.GetFunction("yepLibrary_GetTimerAccuracy", typeof(yepLibrary_GetTimerAccuracy_Delegate)); Library.yepLibrary_GetString = (yepLibrary_GetString_Delegate)nativeLibrary.GetFunction("yepLibrary_GetString", typeof(yepLibrary_GetString_Delegate)); }
internal static void Init() { Library.processABI = Process.DetectABI(); #if YEP_BUNDLE_LIBRARY Library.nativeLibrary = Loader.LoadNativeLibrary(); Library.Bind(nativeLibrary); Core.Bind(nativeLibrary); Math.Bind(nativeLibrary); #endif Status status = yepLibrary_Init(); if (status != Status.Ok) throw new System.SystemException("Failed to initialize Yeppp! library"); }
internal static void Unbind() { Library.yepLibrary_Init = null; Library.yepLibrary_Release = null; Library.yepLibrary_GetVersion = null; Library.yepLibrary_GetCpuIsaFeatures = null; Library.yepLibrary_GetCpuSimdFeatures = null; Library.yepLibrary_GetCpuSystemFeatures = null; Library.yepLibrary_GetCpuVendor = null; Library.yepLibrary_GetCpuArchitecture = null; Library.yepLibrary_GetCpuMicroarchitecture = null; Library.yepLibrary_GetCpuCyclesAcquire = null; Library.yepLibrary_GetCpuCyclesRelease = null; Library.yepLibrary_GetTimerTicks = null; Library.yepLibrary_GetTimerFrequency = null; Library.yepLibrary_GetTimerAccuracy = null; Library.yepLibrary_GetString = null; Library.nativeLibrary.Dispose(); Library.nativeLibrary = null; }