From 4310a3d578ff6879b057295a7c8a3bbce97745e1 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Fri, 15 Nov 2024 15:26:23 -0800 Subject: [PATCH] Minor cleanup. Upgraded dependencies to GA versions. --- .../FunctionsNetHost/FunctionsNetHost.csproj | 4 ++-- .../FunctionsNetHost/Native/NativeExports.cs | 19 +++++++++++++++++++ .../PlaceholderApp/Interop/NativeMethods.cs | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/host/src/FunctionsNetHost/FunctionsNetHost.csproj b/host/src/FunctionsNetHost/FunctionsNetHost.csproj index 4f2fa1ae9..ac197d323 100644 --- a/host/src/FunctionsNetHost/FunctionsNetHost.csproj +++ b/host/src/FunctionsNetHost/FunctionsNetHost.csproj @@ -30,8 +30,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/host/src/FunctionsNetHost/Native/NativeExports.cs b/host/src/FunctionsNetHost/Native/NativeExports.cs index f5ef01554..555a288e1 100644 --- a/host/src/FunctionsNetHost/Native/NativeExports.cs +++ b/host/src/FunctionsNetHost/Native/NativeExports.cs @@ -33,6 +33,25 @@ public static unsafe int RegisterCallbacks(IntPtr pInProcessApplication, Logger.Log($"Error in RegisterCallbacks: {ex}"); return 0; } + } + + [UnmanagedCallersOnly(EntryPoint = "register_startuphook_callback")] + public static unsafe int RegisterStartupHookCallback(IntPtr pInProcessApplication, + delegate* unmanaged requestCallback, + IntPtr grpcHandler) + { + Logger.LogTrace("NativeExports.RegisterStartupHookCallback method invoked."); + + try + { + NativeHostApplication.Instance.SetStartupHookCallbackHandles(requestCallback, grpcHandler); + return 1; + } + catch (Exception ex) + { + Logger.Log($"Error in RegisterStartupHookCallback: {ex}"); + return 0; + } } [UnmanagedCallersOnly(EntryPoint = "send_streaming_message")] diff --git a/host/src/PlaceholderApp/Interop/NativeMethods.cs b/host/src/PlaceholderApp/Interop/NativeMethods.cs index f95bcc7cc..760eee007 100644 --- a/host/src/PlaceholderApp/Interop/NativeMethods.cs +++ b/host/src/PlaceholderApp/Interop/NativeMethods.cs @@ -26,7 +26,7 @@ internal static unsafe void RegisterForStartupHookCallback() internal static void RegisterStartupHookMessageHandlingCallback(delegate* unmanaged requestCallback, nint grpcHandler) { - _ = register_startuphook_callbacks(nint.Zero, requestCallback, grpcHandler); + _ = register_startuphook_callback(nint.Zero, requestCallback, grpcHandler); } /// @@ -45,7 +45,7 @@ internal static SpecializeMessage WaitForSpecializationMessage() } [DllImport(NativeWorkerDll)] - private static extern unsafe int register_startuphook_callbacks(nint pInProcessApplication, delegate* unmanaged requestCallback, nint grpcHandler); + private static extern unsafe int register_startuphook_callback(nint pInProcessApplication, delegate* unmanaged requestCallback, nint grpcHandler); [UnmanagedCallersOnly] private static unsafe nint StartupHookCallbackHandler(byte** nativeMessage, int nativeMessageSize, nint grpcHandler)