From e478462487f9b0901efbbff222551f4ba1e7d28c Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 17 Jan 2025 10:16:03 -0800 Subject: [PATCH] LibraryLoadCallback --- BeefLibs/corlib/src/Internal.bf | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/BeefLibs/corlib/src/Internal.bf b/BeefLibs/corlib/src/Internal.bf index a6b6c7a5..a4f4d507 100644 --- a/BeefLibs/corlib/src/Internal.bf +++ b/BeefLibs/corlib/src/Internal.bf @@ -234,8 +234,20 @@ namespace System public static extern void BfDelegateTargetCheck(void* target); [CallingConvention(.Cdecl), AlwaysInclude] public static extern void* LoadSharedLibrary(char8* filePath); - [CallingConvention(.Cdecl), AlwaysInclude] - public static extern void LoadSharedLibraryInto(char8* filePath, void** libDest); + [AlwaysInclude, LinkName("Beef_LoadSharedLibraryInto")] + public static void LoadSharedLibraryInto(char8* filePath, void** libDest) + { + if (*libDest == null) + { + if (Runtime.LibraryLoadCallback != null) + *libDest = Runtime.LibraryLoadCallback(filePath); + } + if (*libDest == null) + { + *libDest = LoadSharedLibrary(filePath); + } + } + [CallingConvention(.Cdecl), AlwaysInclude] public static extern void* GetSharedProcAddress(void* libHandle, char8* procName); [CallingConvention(.Cdecl), AlwaysInclude]