Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
MONGOC_INIT_CLEANUP(3)		   libmongoc		MONGOC_INIT_CLEANUP(3)

SYNOPSIS
       Initialize  the	MongoDB	C Driver by calling mongoc_init() exactly once
       at the beginning	of your	program. It is	responsible  for  initializing
       global state such as process counters, SSL, and threading primitives.

       Exception  to  this is mongoc_log_set_handler(),	which should be	called
       before mongoc_init() or some log	traces would not use your log handling
       function. See Custom Log	Handlers for a detailed	example.

       Call mongoc_cleanup() exactly once at the end of	your  program  to  re-
       lease  all memory and other resources allocated by the driver. You must
       not call	any other MongoDB C Driver functions  after  mongoc_cleanup().
       Note   that  mongoc_init()  does	 not  reinitialize  the	 driver	 after
       mongoc_cleanup().

DEPRECATED FEATURE: AUTOMATIC INITIALIZATION AND CLEANUP
       On some platforms the driver can	automatically call  mongoc_init()  be-
       fore  main,  and	 call  mongoc_cleanup()	 as the	process	exits. This is
       problematic in situations where related libraries also execute  cleanup
       code  on	 shutdown, and it creates inconsistent rules across platforms.
       Therefore the automatic initialization and cleanup  feature  is	depre-
       cated, and will be dropped in version 2.0. Meanwhile, for backward com-
       patibility,  the	feature	is enabled by default on platforms where it is
       available.

       For  portable,  future-proof  code,  always  call   mongoc_init()   and
       mongoc_cleanup()	yourself, and configure	the driver like:

	  cmake	-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF

AUTHOR
       MongoDB,	Inc

COPYRIGHT
       2009-present, MongoDB, Inc.

1.30.2				 Apr 12, 2025		MONGOC_INIT_CLEANUP(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=mongoc_init_cleanup&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help