1MONGOC_INIT_CLEANUP(3) MongoDB C Driver MONGOC_INIT_CLEANUP(3)
2
3
4
6 mongoc_init_cleanup - Initialization and cleanup
7
9 Initialize the MongoDB C Driver by calling mongoc_init exactly once at
10 the beginning of your program. It is responsible for initializing
11 global state such as process counters, SSL, and threading primitives.
12
13 Call mongoc_cleanup exactly once at the end of your program to release
14 all memory and other resources allocated by the driver. You must not
15 call any other MongoDB C Driver functions after mongoc_cleanup. Note
16 that mongoc_init does not reinitialize the driver after mongoc_cleanup.
17
19 On some platforms the driver can automatically call mongoc_init before
20 main, and call mongoc_cleanup as the process exits. This is problematic
21 in situations where related libraries also execute cleanup code on
22 shutdown, and it creates inconsistent rules across platforms. Therefore
23 the automatic initialization and cleanup feature is deprecated, and
24 will be dropped in version 2.0. Meanwhile, for backward compatibility,
25 the feature is enabled by default on platforms where it is available.
26
27 For portable, future-proof code, always call mongoc_init and mon‐
28 goc_cleanup yourself, and configure the driver like:
29
30 cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=NO
31
33 MongoDB, Inc
34
36 2017-present, MongoDB, Inc
37
38
39
40
411.15.2 Nov 06, 2019 MONGOC_INIT_CLEANUP(3)