From 72c946233ae0130a4b6d9d01fed45cfe38d9c1c4 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Thu, 30 Sep 2021 11:57:25 -0400 Subject: [PATCH] [loader] Look for P/Invoke libs next to the managed assembly If there's a P/Invoke to a library, direct `netcore_probe_for_module` to look in NATIVE_DLL_SEARCH_DIRECTORIES, followed by the directory containing the managed assembly. Fixes https://github.com/dotnet/runtime/issues/59766 --- src/mono/mono/metadata/native-library.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/metadata/native-library.c b/src/mono/mono/metadata/native-library.c index 766f20a80b1a7a..eae091bc6c15c3 100644 --- a/src/mono/mono/metadata/native-library.c +++ b/src/mono/mono/metadata/native-library.c @@ -1048,7 +1048,7 @@ lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_ou mono_custom_attrs_free (cinfo); } if (flags < 0) - flags = 0; + flags = DLLIMPORTSEARCHPATH_ASSEMBLY_DIRECTORY; module = netcore_lookup_native_library (alc, image, new_scope, flags); if (!module) {