/error

midl /error { allocation | stub_data | ref | bounds_check | none | all }

allocation
Checks whether midl_user_allocate returns a null value, indicating an out-of-memory error.
stub_data
Generates a stub that catches unmarshalling exceptions on the server side and propogates them back to the client.
ref
Generates code that checks at run time to ensure that no NULL [ref] pointers are being passed to the client stubs and raises an RPC_X_NULL_REF_POINTER exception if it finds any.
bounds_check
Checks size of conformant-varying and varying arrays against transmission length specification.
none
Performs no error checking.
all
Performs all error checking.

Examples

midl /error allocation filename.idl 
midl /error none filename.idl 
 

Remarks

The /error switch selects the amount of error checking to be performed by the generated stub files.

By default, the MIDL compiler generates code that checks for enum and certain memory-access errors. The enum errors that are checked are truncation errors caused by conversion between long enum types (32-bit integers) and short enum types (the network-data representation of enum) and the number of identifiers in an enumeration exceeding 32,767. The memory-access error checking is for pointers that exceed the end of the buffer in marshalling code and for conformant arrrays whose size is less than zero. Use the /error bounds_check flag to check for other invalid array bounds.

When you specify /error allocate, the stubs include code that raises an exception when midl_user_allocate returns 0.

The /error stub_data option prevents client data from crashing the server during unmarshalling; in effect providing a more robust method of handling the unmarshalling operation.

See Also

General MIDL Command-line Syntax