SYNOPSIS

void mongoc_init    (void);
void mongoc_cleanup (void);

DESCRIPTION

The mongoc_init() function shall initialize the mongoc library. While much of mongoc library functionality is available without monogc_init(), some functions require global initialization and use this hook as the opportunity to run their initialization code. On Windows, this calls WSAStartup().

It is a programming error not to call this function before use of any dependent subsytems. Those functions will assert() in the absence of proper initialization.

The mongoc_init() function is NOT thread-safe. It should be called early and in a single threaded environment. Ideally as one of the first activities in main().

mongoc_cleanup() should only be called after all code paths using libmongoc-1.0 have completed executing. If you are using libmongoc through dlopen() facilities, you should do this before calling dlclose(). On Windows, this calls WSACleanup().

RETURN VALUE

The mongoc_init() function has no return value.

ERRORS

No errors are defined.

SEE ALSO

DEPENDENT SUBSYSTEMS

AUTHORS

This page was written by MongoDB Inc.