/error switch
The /error switch determines the types of error checking that the generated stubs will perform at run time.
Note
This feature is obsolete and no longer supported. The use of the /robust switch is recommended.
midl /error { allocation | stub_data | ref | bounds_check | none | all }
Switch Options
-
allocation
-
Checks whether midl_user_allocate returns a NULL value, indicating an out-of-memory error.
-
stub_data
-
Generates a stub that catches unmarshaling exceptions on the server side and propagates them back to the client.
-
ref
-
Generates code that runs a check at run time to ensure that no NULL reference 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. Effective with MIDL version 5.0, this is a default compiler switch.
Remarks
The /error switch selects the number of error checks that the generated stub files will perform. Effective with MIDL version 5.0, the default setting is /error all.
The enum errors that are checked (by default in all versions of MIDL) are truncation errors caused when converting 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 (also by default in all versions of MIDL) is for pointers that exceed the end of the buffer in marshaling code and for conformant arrays whose size is less than zero. Use the /error bounds_check flag to check for other invalid array bounds.
When you specify /error allocation, 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 unmarshaling, effectively providing a more robust method of handling the unmarshaling operation.
Effective with Windows 2000, the underlying run-time NDR marshaling engine performs most of these checks. This means that if you are using one of the fully-interpreted modes (/Oi, /Oif) of stub generation, choosing different error checking options will not have a marked effect on performance.
Examples
midl /error allocation filename.idl
midl /error none filename.idl
See also