uuid attribute

The [uuid] interface attribute designates a universally unique identifier (UUID) that is assigned to the interface and that distinguishes it from other interfaces.

uuid (string-uuid) 
uuid ("string-uuid")



Specifies a string consisting of 8 hexadecimal digits followed by a hyphen, then three groups of 4 hexadecimal digits each followed by a hyphen, then 12 hexadecimal digits. You can enclose the UUID string in quotes, except when you use the MIDL compiler switch /osf.


The run-time library uses the interface UUID that the [uuid] attribute designates to help establish communication between the client and server applications. The [uuid] attribute can appear in the interface attribute list for either an RPC interface or a COM interface.

For an RPC interface, the interface attribute list must include either the [uuid] attribute or the [local] attribute, and the one you choose must occur exactly once. If the list includes the [uuid] attribute, it can also include the [version] attribute.

For a COM interface (identified by the [object] interface attribute), the interface attribute list must include the [uuid] attribute, but it cannot include the [version] attribute. The list for a COM interface can include the [local] attribute even though the [uuid] attribute is present.

Microsoft RPC supports an extension to DCE IDL that allows the UUID to be enclosed in double quotation marks ("" ""). The quoted form is needed for C-compiler preprocessors that interpret UUID numbers as floating-point numbers.

All UUID values should be computer-generated to guarantee uniqueness. Use the Uuidgen utility to generate unique UUID values.

The UUID and version numbers of the interface are used to determine whether the client can bind to the server. For the client to bind to the server, the UUID specified in the client and server interfaces must be the same.

Note that an interface without attributes can be imported into a base IDL file. However, the interface must contain only datatypes with no procedures. If even one procedure is contained in the interface, a local or UUID attribute must be specified.



See also

Interface Definition (IDL) File