static RfcRc RFC_START_PROGRAM_Handler(IntPtr rfcHandle, IntPtr funcHandle, out RfcErrorInfo errorInfo) { if (!RegisteredCallbacks.TryGetValue(rfcHandle, out var startProgramDelegate)) { errorInfo = new RfcErrorInfo(RfcRc.RFC_INVALID_HANDLE, RfcErrorGroup.EXTERNAL_APPLICATION_FAILURE, "", "no connection registered for this callback", "", "", "", "", "", "", ""); return(RfcRc.RFC_INVALID_HANDLE); } var commandBuffer = new char[513]; var rc = Interopt.RfcGetStringByIndex(funcHandle, 0, commandBuffer, (uint)commandBuffer.Length - 1, out var commandLength, out errorInfo); if (rc != RfcRc.RFC_OK) { return(rc); } var command = new string(commandBuffer, 0, (int)commandLength); errorInfo = startProgramDelegate(command); return(errorInfo.Code); }