1MONGOC_INIT_CLEANUP(3)             libmongoc            MONGOC_INIT_CLEANUP(3)
2
3
4

NAME

6       mongoc_init_cleanup - Initialization and cleanup
7

SYNOPSIS

9       Initialize  the  MongoDB C Driver by calling mongoc_init() exactly once
10       at the beginning of your program. It is  responsible  for  initializing
11       global state such as process counters, SSL, and threading primitives.
12
13       Exception  to  this is mongoc_log_set_handler(), which should be called
14       before mongoc_init() or some log traces would not use your log handling
15       function. See Custom Log Handlers for a detailed example.
16
17       Call  mongoc_cleanup()  exactly  once at the end of your program to re‐
18       lease all memory and other resources allocated by the driver. You  must
19       not  call  any other MongoDB C Driver functions after mongoc_cleanup().
20       Note  that  mongoc_init()  does  not  reinitialize  the  driver   after
21       mongoc_cleanup().
22

DEPRECATED FEATURE: AUTOMATIC INITIALIZATION AND CLEANUP

24       On  some  platforms the driver can automatically call mongoc_init() be‐
25       fore main, and call mongoc_cleanup() as  the  process  exits.  This  is
26       problematic  in situations where related libraries also execute cleanup
27       code on shutdown, and it creates inconsistent rules  across  platforms.
28       Therefore  the  automatic  initialization and cleanup feature is depre‐
29       cated, and will be dropped in version 2.0. Meanwhile, for backward com‐
30       patibility,  the feature is enabled by default on platforms where it is
31       available.
32
33       For  portable,  future-proof  code,  always  call   mongoc_init()   and
34       mongoc_cleanup() yourself, and configure the driver like:
35
36          cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF
37

AUTHOR

39       MongoDB, Inc
40
42       2017-present, MongoDB, Inc
43
44
45
46
471.24.3                           Aug 17, 2023           MONGOC_INIT_CLEANUP(3)
Impressum