1 // Copyright Maciej Sobczak 2008-2019. 2 // This file is part of YAMI4. 3 // 4 // YAMI4 is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // YAMI4 is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with YAMI4. If not, see <http://www.gnu.org/licenses/>. 16 17 #ifndef YAMICORE_FATAL_ERRORS_H_INCLUDED 18 #define YAMICORE_FATAL_ERRORS_H_INCLUDED 19 20 #include "dll.h" 21 22 namespace yami 23 { 24 25 namespace core 26 { 27 28 /// Type of function callback for reporting internal fatal errors. 29 /// 30 /// Note: This function is supposed to be a customization point for 31 /// reporting assertion errors; even if this function returns, 32 /// the code calling it will abort immediately after that. 33 /// The default handler prints the message on standard error channel. 34 /// 35 /// @param source_file Name of the source file where the error occured. 36 /// @param line_number Line number of the place where assertion failed. 37 extern "C" typedef void (*fatal_error_function)( 38 const char * source_file, int line_number); 39 40 /// Registers the custom handler for reporting fatal errors. 41 /// 42 /// Note: this function is not thread-safe and should be called (if at all) 43 /// before any agent is initialized. 44 DLL void register_fatal_error_handler(fatal_error_function handler); 45 46 } // namespace core 47 48 namespace details 49 { 50 51 DLL void fatal_failure(const char * source_file, int line_number); 52 53 } // namespace details 54 55 } // namespace yami 56 57 #endif // YAMICORE_FATAL_ERRORS_H_INCLUDED 58