1 /* $NetBSD: lib.c,v 1.1.1.7 2021/08/19 11:45:27 christos Exp $ */ 2 3 /* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * This Source Code Form is subject to the terms of the Mozilla Public 7 * License, v. 2.0. If a copy of the MPL was not distributed with this 8 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 9 * 10 * See the COPYRIGHT file distributed with this work for additional 11 * information regarding copyright ownership. 12 */ 13 14 /*! \file */ 15 16 #include <isc/bind9.h> 17 #include <isc/lib.h> 18 #include <isc/mem.h> 19 #include <isc/util.h> 20 21 #include "config.h" 22 #include "mem_p.h" 23 #include "tls_p.h" 24 #include "trampoline_p.h" 25 26 #ifndef ISC_CONSTRUCTOR 27 #error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9. 28 #endif 29 30 /*** 31 *** Functions 32 ***/ 33 34 void 35 isc_lib_register(void) { 36 isc_bind9 = false; 37 } 38 39 void 40 isc__initialize(void) ISC_CONSTRUCTOR; 41 void 42 isc__shutdown(void) ISC_DESTRUCTOR; 43 44 void 45 isc__initialize(void) { 46 isc__mem_initialize(); 47 isc__tls_initialize(); 48 isc__trampoline_initialize(); 49 } 50 51 void 52 isc__shutdown(void) { 53 isc__trampoline_shutdown(); 54 isc__tls_shutdown(); 55 isc__mem_shutdown(); 56 } 57 58 /* 59 * This is a workaround for situation when libisc is statically linked. Under 60 * normal situation, the linker throws out all symbols from compilation unit 61 * when no symbols are used in the final binary. This empty function must be 62 * called at least once from different compilation unit (mem.c in this case). 63 */ 64 void 65 isc_enable_constructors() { 66 /* do nothing */ 67 } 68