Quick start manual
Object interfaces
10-3
Interface types
Interface identification
An interface declaration can specify a globally unique identifier (GUID), represented 
by a string literal enclosed in brackets immediately preceding the member list. The 
GUID part of the declaration must have the form
['{xxxxxxxx–xxxx–xxxx–xxxx–xxxxxxxxxxxx}']
where each x is a hexadecimal digit (0 through 9 or A through F). On Windows, the 
Type Library editor automatically generates GUIDs for new interfaces. You can also 
generate GUIDs by pressing 
Ctrl+Shift+G
 in the Code editor.
A GUID is a 16-byte binary value that uniquely identifies an interface. If an interface 
has a GUID, you can use interface querying to get references to its implementations. 
(See “Interface querying” on page 10-10.)
The TGUID and PGUID types, declared in the System unit, are used to manipulate 
GUIDs.
type
PGUID = ^TGUID;
TGUID = packed record
D1: Longword;
D2: Word;
D3: Word;
D4: array[0..7] of Byte;
end;
When you declare a typed constant of type TGUID, you can use a string literal to 
specify its value. For example,
const IID_IMalloc: TGUID = '{00000002-0000-0000-C000-000000000046}';
In procedure and function calls, either a GUID or an interface identifier can serve as a 
value or constant parameter of type TGUID. For example, given the declaration
function Supports(Unknown: IInterface; const IID: TGUID): Boolean;
Supports can be called in either of two ways
if Supports(Allocator, IMalloc) then ...
or
if Supports(Allocator, IID_IMalloc) then ...
Calling conventions for interfaces
The default calling convention for interface methods is register, but interfaces shared 
among modules (especially if they are written in different languages) should declare 
all methods with stdcall. Use safecall to implement CORBA interfaces. On Windows, 
you can use safecall to implement methods of dual interfaces (as described in “Dual 
interfaces (Windows only)” on page 10-13).
For more information about calling conventions, see “Calling conventions” on 
page 6-5.










