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

SYNOPSIS

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

DEPRECATED FEATURE: AUTOMATIC INITIALIZATION AND CLEANUP

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

AUTHOR

36       MongoDB, Inc
37
39       2017-present, MongoDB, Inc
40
41
42
43
441.25.1                           Nov 08, 2023           MONGOC_INIT_CLEANUP(3)
Impressum