diff --git a/host/src/FunctionsNetHost/FunctionsNetHost.csproj b/host/src/FunctionsNetHost/FunctionsNetHost.csproj index 4f2fa1ae..ac197d32 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 f5ef0155..555a288e 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 f95bcc7c..760eee00 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)