MIDL Base Types

To be transmitted over a network, all data types must resolve to a MIDL base type or predefined type.

MIDL supports the following base and predefined types:

Data Type Description Default sign
boolean 8 bits. Not compatible with oleautomation interfaces; use VARIANT_BOOL instead. unsigned
byte 8 bits (not applicable)
char 8 bits unsigned
double 64-bit floating point number (not applicable)
error_status_t 32-bit unsigned integer for returning status values for error handling. unsigned
float 32-bit floating point number (not applicable)
handle_t primitive handle type for binding (not applicable)
hyper 56-bit integer signed
int 32-bit integer. On 16-bit platforms, cannot appear in remote functions without a size qualifier such as short, small, long or hyper. signed
long 32-bit integer signed
short 16-bt integer signed
small 8-bit integer signed
void Indicates that procedure does not return a value. (not applicable)
void * 32-bit pointer for context handles only. (not applicable)
wchar_t 16-bit predefined type for wide characters. unsigned

Signed vs. Unsigned Types

Compilers that use different defaults for signed and unsigned types can cause software errors in your distributed application. You can avoid these problems by explicitly declaring your character types as signed or unsigned. Note that DCE IDL compilers do not recognize the keyword signed. Therefore, this feature is not available when you use the MIDL compiler /osf switch.

MIDL defines the small type to take the same default sign as the char type in the target C compiler. If the compiler assumes that char is unsigned, small will also be defined as unsigned. Many C compilers let you change the default as a command-line option. For example, in the Microsoft® Visual C++® development environment, the /J command-line option changes the default sign of char from signed to unsigned.

You can also control the sign of variables of type char and small with the MIDL compiler command-line switch /char. This switch allows you to specify the default sign used by your compiler. The MIDL compiler explicitly declares the sign of all char types that do not match your C-compiler default type in the generated header file.