represent_as
typedef
[represent_as(repr-type) [ , type-attribute-list ] ]
named-type;
void
__RPC_USER named-type_from_local (
repr-type __RPC_FAR * ,
named-type __RPC_FAR *
__RPC_FAR * );
void
__RPC_USER named-type_to_local (
named-type __RPC_FAR * ,
repr-type __RPC_FAR * );
void
__RPC_USER named-type_free_inst (
named-type __RPC_FAR * );
void
__RPC_USER named-type_free_local (
repr-type__RPC_FAR * );
named-type
Specifies the
named transfer data type that is transferred between client and server.
type-attribute-list
Specifies one
or more attributes that apply to the type. Separate multiple attributes with
commas.
repr-type
Specifies the
represented local type in the target language that is presented to the client
and server applications.
Example
//these data types defined in .IDL or elsewhere
typedef struct
_lbox {
long data;
struct
_lbox *next;
} lbox;
typedef [ref] lbox *PBOX_LOC;
typedef long LONG4[4];
//in .ACF file :
interfaceFoo
{
typedef [
represent_as(PBOX_LOC) ] LONG4;
}
Remarks
The represent_as
attribute associates a named local type in the target language repr-type with
a transfer type named-type that is transferred between client and
server. You must supply routines that convert between the local and the
transfer types and that free memory used to hold the converted data. The represent_as
attribute instructs the stubs to call the user-supplied conversion routines.
The
transferred type named-type must resolve to a MIDL base type, predefined
type, or to a type identifier. For more information, see base_types
You must
supply the following routines:
Routine
name |
Description |
named_type_from_local |
Allocates
an instance of the network type and converts from the local type to the
network type |
named_type_to_local |
Converts
from the network type to the local type |
named_type_free_local |
Frees
memory allocated by a call to the named_type_to_local routine,
but not the type itself |
named_type_free_inst |
Frees
storage for the network type (both sides) |
The client
stub calls named-type_from_local to allocate space for the
transmitted type and to translate the data from the local type to the network
type. The server stub allocates space for the original data type and calls named-type_to_local
to translate the data from the network type to the local type.
Upon return
from the application code, the client and server stubs call named-type_free_inst
to deallocate the storage for network type. The client stub calls named-type_free_local
to deallocate storage returned by the routine.
The following
types cannot have a represent_as attribute:
Conformant, varying, or
conformant varying arrays.
Structures in which the last
member is a conformant array (a conformant structure).
Pointers or types that contain
a pointer.
Predefined types handle_t,
void.
A type cannot have both the represent_as
attribute and the handle attribute.
See Also