Skip to content

Commit 2c1aaef

Browse files
committed
fix dll loading in tests
1 parent 1b88783 commit 2c1aaef

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/runtime/runtime.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private static string GetDefaultDllName(Version version)
5454
string prefix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "lib";
5555
string suffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
5656
? Invariant($"{version.Major}{version.Minor}")
57-
: Invariant($"{version.Major}.{version.Minor}");
57+
: Invariant($"{version.Major}.{version.Minor}m");
5858
string ext = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".dll"
5959
: RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? ".dylib"
6060
: ".so";
@@ -2534,7 +2534,11 @@ static Delegates()
25342534
PyThreadState_SetAsyncExcLP64 = (delegate* unmanaged[Cdecl]<ulong, IntPtr, int>)GetFunctionByName("PyThreadState_SetAsyncExc", GetUnmanagedDll(_PythonDll));
25352535
}
25362536

2537-
static global::System.IntPtr GetUnmanagedDll(string libraryName) => libraryLoader.Load(libraryName);
2537+
static global::System.IntPtr GetUnmanagedDll(string libraryName)
2538+
{
2539+
if (libraryName is null) return IntPtr.Zero;
2540+
return libraryLoader.Load(libraryName);
2541+
}
25382542

25392543
static global::System.IntPtr GetFunctionByName(string functionName, global::System.IntPtr libraryHandle)
25402544
=> libraryLoader.GetFunction(libraryHandle, functionName);

0 commit comments

Comments
 (0)