#### DCE Messaging and Message Catalogs

The reader may be wondering why, in the previous example, it was not necessary to explicitly open the message catalog before making the call to retrieve and print the message itself. The answer is that dce_printf( ) takes care of this step implicitly. It can find the message catalog because the catalog's name is generated from the component field in the first part of the sams file. Of course, for this to work, the message catalog must be installed in the correct system-defined location before the application is run.

An application may even dispense with the use of installed message catalogs altogether, and use "in-memory" message tables instead. The necessary code to declare the sams file messages as arrays in program memory is contained in the dce cmp msg.c file generated with the sams -o t option. To initialize the table before using it the application must also call the dce_msg_define_msg_table( ) routine, described in Message Table Routines. The message routines will, when called, attempt to use the application's message catalog; but if it cannot be found, the in-memory table will be used instead.

###