I want to use something similar to NativeLibrary.TryLoad
for a native DLL in .NET Standard. But I cannot find a method for it. Is there a good way to do this?
I know I can do things like
[DllImport(@"alib.dll")]
internal extern static int func();
but that is not what I want in this case. I'm tracking a bug that causes a library to sometimes not load (from inside a DLL that I'm calling). So I want to preload it in my program and see if that helps.
You can use LoadLibrary or LoadLibraryEx (https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw).