Skip to content

Commit a0a1dc1

Browse files
committed
correctly detect DLL on *nix when running from Python
1 parent c75229a commit a0a1dc1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/runtime/runtime.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ private static string GetDefaultDllName()
3737
string dll = Environment.GetEnvironmentVariable("PYTHONNET_PYDLL");
3838
if (dll is not null) return dll;
3939

40+
try
41+
{
42+
LibraryLoader.Instance.GetFunction(IntPtr.Zero, "PyUnicode_GetMax");
43+
return null;
44+
} catch (MissingMethodException) { }
45+
4046
string verString = Environment.GetEnvironmentVariable("PYTHONNET_PYVER");
4147
if (!Version.TryParse(verString, out var version)) return null;
4248

0 commit comments

Comments
 (0)