diff options
author | vnugent <public@vaughnnugent.com> | 2024-03-30 21:36:18 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-03-30 21:36:18 -0400 |
commit | 3ff90da4f02af47ea6d233fdd4445337ebe36452 (patch) | |
tree | 1df23f215922e8f11679f01ca847c13a15e77478 /lib/Utils/src/Native | |
parent | 8d6b79b5ae309b36f265ba81529bcef8bfcd7414 (diff) |
refactor: Updates, advanced tracing, http optimizations
Diffstat (limited to 'lib/Utils/src/Native')
-rw-r--r-- | lib/Utils/src/Native/SafeLibraryHandle.cs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Utils/src/Native/SafeLibraryHandle.cs b/lib/Utils/src/Native/SafeLibraryHandle.cs index 5fb2283..4b4ead4 100644 --- a/lib/Utils/src/Native/SafeLibraryHandle.cs +++ b/lib/Utils/src/Native/SafeLibraryHandle.cs @@ -63,9 +63,8 @@ namespace VNLib.Utils.Native { //Get the method pointer IntPtr nativeMethod = NativeLibrary.GetExport(handle, functionName); - //Get the delegate for the function pointer - T method = Marshal.GetDelegateForFunctionPointer<T>(nativeMethod); - return new(this, method); + AdvancedTrace.WriteLine($"Loaded function '{functionName}' with address: 0x'{nativeMethod:x}'"); + return new(this, Marshal.GetDelegateForFunctionPointer<T>(nativeMethod)); } catch { @@ -90,6 +89,7 @@ namespace VNLib.Utils.Native this.ThrowIfClosed(); //Get the method pointer IntPtr nativeMethod = NativeLibrary.GetExport(handle, functionName); + AdvancedTrace.WriteLine($"Loaded function '{functionName}' with address: 0x'{nativeMethod:x}'"); //Get the delegate for the function pointer return Marshal.GetDelegateForFunctionPointer<T>(nativeMethod); } @@ -97,6 +97,7 @@ namespace VNLib.Utils.Native ///<inheritdoc/> protected override bool ReleaseHandle() { + AdvancedTrace.WriteLine($"Releasing library handle: 0x'{handle:x}'"); //Free the library and set the handle as invalid NativeLibrary.Free(handle); SetHandleAsInvalid(); @@ -211,7 +212,9 @@ namespace VNLib.Utils.Native NatveLibraryResolver resolver = new(libPath, assembly, searchPath); - return resolver.ResolveAndLoadLibrary(out library); + bool success = resolver.ResolveAndLoadLibrary(out library); + AdvancedTrace.WriteLineIf(success, $"Loaded library '{libPath}' with address: 0x'{library?.DangerousGetHandle():x}'"); + return success; } } } |