mhd_lib_init_auto.h (3491B)
1 /* SPDX-License-Identifier: LGPL-2.1-or-later OR (GPL-2.0-or-later WITH eCos-exception-2.0) */ 2 /* 3 This file is part of GNU libmicrohttpd. 4 Copyright (C) 2024 Evgeny Grin (Karlson2k) 5 6 GNU libmicrohttpd is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License as published by the Free Software Foundation; either 9 version 2.1 of the License, or (at your option) any later version. 10 11 GNU libmicrohttpd is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 Alternatively, you can redistribute GNU libmicrohttpd and/or 17 modify it under the terms of the GNU General Public License as 18 published by the Free Software Foundation; either version 2 of 19 the License, or (at your option) any later version, together 20 with the eCos exception, as follows: 21 22 As a special exception, if other files instantiate templates or 23 use macros or inline functions from this file, or you compile this 24 file and link it with other works to produce a work based on this 25 file, this file does not by itself cause the resulting work to be 26 covered by the GNU General Public License. However the source code 27 for this file must still be made available in accordance with 28 section (3) of the GNU General Public License v2. 29 30 This exception does not invalidate any other reasons why a work 31 based on this file might be covered by the GNU General Public 32 License. 33 34 You should have received copies of the GNU Lesser General Public 35 License and the GNU General Public License along with this library; 36 if not, see <https://www.gnu.org/licenses/>. 37 */ 38 39 /** 40 * @file src/mhd2/mhd_lib_init_auto.h 41 * @brief Declarations for the library global initialiser and deinitialiser 42 * that called automatically at startup and shutdown of the application 43 * @author Karlson2k (Evgeny Grin) 44 */ 45 46 #ifndef MHD_LIB_INIT_AUTO_H 47 #define MHD_LIB_INIT_AUTO_H 1 48 #include "mhd_sys_options.h" 49 50 #if (defined(__MINGW32__) || defined(__MINGW64__)) \ 51 || (defined(_WIN32) && defined(_MT) && defined(_DLL)) 52 # define mhd_INIT_USE_MHD_DLLMAIN 1 53 #endif 54 55 #ifdef mhd_INIT_USE_MHD_DLLMAIN 56 # define AUTOINIT_FUNCS_CALL_USR_DLLMAIN 1 /* Call of additional DLL init functions on W32 */ 57 # define AUTOINIT_FUNCS_USR_DLLMAIN_NAME mhd_DllMain /* The name of additional DLL init function on W32 */ 58 # define AUTOINIT_FUNCS_DECLARE_USR_DLLMAIN 1 /* Automatically declare this function */ 59 #endif 60 #define AUTOINIT_FUNCS_NO_WARNINGS_SUNPRO_C 1 /* This compiler is supported directly */ 61 #include "autoinit_funcs.h" 62 63 #ifdef AIF_AUTOINIT_FUNCS_ARE_SUPPORTED 64 /* Use automatically called initialisation functions */ 65 # define mhd_AUTOINIT_FUNCS_USE 1 66 #elif defined(AIF_PRAGMA_INIT_SUPPORTED) && defined(AIF_PRAGMA_FINI_SUPPORTED) 67 /* Use automatically called initialisation functions */ 68 # define mhd_AUTOINIT_FUNCS_USE 1 69 /* Use "#pragma" to set initialisation functions */ 70 # define mhd_AUTOINIT_FUNCS_PRAGMA 1 71 #endif 72 73 74 #ifdef mhd_AUTOINIT_FUNCS_USE 75 /** 76 * Perform the minimal initialisation of the library 77 */ 78 void 79 mhd_lib_global_init_auto (void); 80 81 /** 82 * Deinitialise resources previously initialised by #mhd_lib_global_lazy_init() 83 */ 84 void 85 mhd_lib_global_deinit_auto (void); 86 87 #endif /* mhd_AUTOINIT_FUNCS_USE */ 88 89 90 #endif /* ! MHD_LIB_INIT_AUTO_H */