DB_ENV->set_msgcall()
Prev | Chapter 5. The DB_ENV Handle | Next

## DB_ENV->set_msgcall()

    #include <db.h>

    void
    DB_ENV->set_msgcall(DB_ENV *dbenv,
        void (*db_msgcall_fcn)(const DB_ENV *dbenv, const char *msg));

There are interfaces in the Berkeley DB library which either directly output informational messages or statistical information, or configure the library to output such messages when performing other operations, for example, DB_ENV->set_verbose() and DB_ENV->stat_print().

The `DB_ENV->set_msgcall()` and DB->set_msgcall() methods are used to pass these messages to the application, and Berkeley DB will call db_msgcall_fcn with each message. It is up to the db_msgcall_fcn function to display the message in an appropriate manner.

Setting db_msgcall_fcn to NULL unconfigures the callback interface.

Alternatively, you can use the DB->set_msgfile() or DB->set_msgfile() methods to display the messages via a C library FILE *.

The `DB_ENV->set_msgcall()` method configures operations performed using the specified DB_ENV handle, not all operations performed on the underlying database environment.

The `DB_ENV->set_msgcall()` method may be called at any time during the life of the application.

### Note

Berkeley DB is not re-entrant. Callback functions should not attempt to make library calls (for example, to release locks or close open handles). Re-entering Berkeley DB is not guaranteed to work correctly, and the results are undefined.

### Parameters

#### db_msgcall_fcn

The db_msgcall_fcn parameter is the application-specified message reporting function. The function takes two parameters:

- `dbenv`

  The dbenv parameter is the enclosing database environment.

- `msg`

  The msg parameter is the message string.

### Class

DB_ENV

### See Also

Database Environments and Related Methods

Prev | Up | Next
DB_ENV->set_isalive() | Home | DB_ENV->set_msgfile()