# mco_metadict_register
RT

> Register a database dictionary in the meta-dictionary.

### Prototype

        MCO_RET mco_metadict_register(	/*IN*/ mco_metadict_header_t * metadict,
                       /*IN*/ const char * name,
                       /*IN*/ const void * dict,
                       /*IN*/ const void * user_data);

### Arguments

metadict | The address of a mco_metadict_header_t structure
name | The name of the dictionary - must be unique within this meta-dictionary
dict | The address of the dictionary, should be received via the generated `<database-name>_get_dictionary()`
user_data | The address of optional application-specific data

### Description

> The API registers a database dictionary in the meta-dictionary. Note that`mco_metadict_init()` automatically registers open conventional memory databases. If the database is opened after the metadictionary is initialized, it can be registered explicitly with this API. It is possible to register database dictionaries before opening the database, or without opening the database (for example, the application might need to just receive the specific schema (dictionary) information).

### Return Codes

MCO_S_OK | The metadictionary was successfully registered
MCO_E_UDA_TOOMANY_ENTRIES | The metadictionary is full
MCO_E_UDA_NAME_TOO_LONG | The dictionary name is too long
MCO_E_UDA_DUPLICATE | The name is already registered

### Example

        Application snippet:

        const char * dbname = "SimpleDb";

        int main(int argc, char* argv[])
        {
            MCO_RET rc;
            unsigned int size;
            mco_metadict_header_t *header;

            mco_metadict_size(10, &size); /* figure out the buffer size to
                                 register 10 database dictionaries */
            ...

            header = (mco_metadict_header_t *) malloc(size);
            mco_metadict_init(header, size); /* initialize the metadict */
            ...
            rc = mco_metadict_register(header, "test_db", mydb_get_dictionary(),

                            &custom_data);

            ...
        }

### Files

Header file:
mcouda.h
Source file:
mcouda.c
Library:
libmcouda.a