PreviousNext

The extern_exceptions Attribute

By default, the IDL compiler declares and initializes all exceptions listed in an exceptions interface attribute in the stub code that it generates. You can use the extern_exceptions attribute to override this behavior; the extern_exceptions attribute allows you to specify one or more exceptions listed in the exceptions interface attribute that you do not want the IDL-generated stub code to declare. If the extern_exceptions attribute appears with no list, it has the same effect as if all IDL-defined exceptions were specified in the list.

The extern_exceptions attribute has the following syntax. (See the example below.)

[extern_exceptions (exception_name [,exception_name]...)]
interface
interface_name

The extern_exceptions attribute indicates that the specified exceptions are defined and initialized in some other external manner before calling the extern_exceptions attribute. They may be predefined exceptions (such as exc_e_exquota) that were provided by another interface, or exceptions that are defined and initialized explicitly by the application itself.

Example Using the extern_exceptions Attribute

In the following example, the exception named in the list in the extern_exceptions attribute in the ACF is not defined or initialized in the IDL-generated stub code. All of the other exceptions listed in the exceptions interface attribute are defined and initialized in the generated stub.

ACF

[extern_exceptions(exc_e_quota)] interface binop {}

/*

*The exc_e_exquota exception is a predefined exception

*(provided in exc_handling.h) and so does not need

*to be declared and initialized in the IDL-generated stub.

*/

IDL File

[uuid(06255501-08af-11cb-8c4f-08002b13d56d),

version (1.1),

exceptions (

exc_e_exquota,

binop_e_aborted,

binop_e_too_busy,

binop_e_shutdown)

] interface binop

{

long binop_add(

[in] long a,

[in] long b

);

}