Skip to content

Commit 1d0ba6e

Browse files
committed
refine
1 parent 484d8dd commit 1d0ba6e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.shared.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ private static IntPtr DllImportResolver(string libraryName, Assembly assembly, D
899899
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && (libraryName == NativeLib.DllName || libraryName == OrtExtensionsNativeMethods.ExtensionsDllName))
900900
{
901901
// Explicitly load with .dll extension to avoid issues where the OS might try .DLL
902-
string fileName = libraryName == NativeLib.DllName ? "onnxruntime.dll" : "ortextensions.dll";
902+
string fileName = libraryName + ".dll";
903903
if (NativeLibrary.TryLoad(fileName, assembly, searchPath, out IntPtr handle))
904904
{
905905
return handle;
@@ -2987,9 +2987,10 @@ internal static class OrtExtensionsNativeMethods
29872987
#elif __IOS__
29882988
internal const string ExtensionsDllName = "__Internal";
29892989
#else
2990-
// For desktop platforms, explicitly specify the DLL name with extension to avoid
2991-
// issues on case-sensitive filesystems. See NativeLib.DllName for detailed explanation.
2992-
internal const string ExtensionsDllName = "ortextensions.dll";
2990+
// For desktop platforms, use the simple name to allow .NET's
2991+
// automatic platform-specific resolution (lib*.so, lib*.dylib, *.dll).
2992+
// Case-sensitivity on Windows is handled by DllImportResolver.
2993+
internal const string ExtensionsDllName = "ortextensions";
29932994
#endif
29942995

29952996
[DllImport(ExtensionsDllName, CharSet = CharSet.Ansi,

0 commit comments

Comments
 (0)