#### Placing an Object's Name Directly in the Name Service

Consider the following situations:

· Suppose you want a server to just advertise the named objects it supports and not use resources to create them until they are needed. As described in the previous topic, an object must be created before it can register itself with the register_named_object( ) function.

· Suppose you want to use a known UUID to represent a named object. If the name does not already exist in the name service, a new UUID is generated via the register_named_object( ) call on the fly. This may be fine for many applications, but, for some, manipulating objects only by their name service names may be cumbersome and inflexible.

If you wish to place a named object in the name service and at the same time use a consistent, stable, and well-known UUID for a named object, you first associate the UUID with the named object in the name service prior to using the register_named_object( ) function. There are typically two ways to place object names in the name service:

· Prior to server startup, you can create or update a named object entry by using dcecp with the rpcentry object and its export operation.

· Your server can create or update a named object entry by using rpc_ns_binding_export( ) during server initialization.

The following example shows a script of dcecp commands and arguments to execute on the server's host to export an object's name and then show the data exported to the entry:

dcecp -c rpcentry export /.:/objects/IdentityMatrix
-interface \{24cb0eba-3eb9-11ce-b1ce-08002bbbf636 0.0\} \\
-binding \{ncacn_ip_tcp `hostname`\} \\
-binding \{ncadg_ip_udp `hostname`\} \\
-object \{dcea4900-65ba-11cd-bb34-08002b3d8412\}
dcecp -c rpcentry show /.:/objects/IdentityMatrix

Attributes and arguments are as follows:

/.:/objects/I dentityMatrix
The object name.

-interface ...
The interface's UUID and version numbers from the interface definition header.

-binding ncacn_ip_tcp 'hostname'
Binding information including a protocol sequence and the host's name (generated with the hostname command).

-object ...
The object UUID desired.

Whether you call the dcecp's rpcentry export operation or the rpc_ns_binding_export( ) routine, the first call automatically creates the entry in the name service and each additional call adds binding information to the entry.

####