midl_user_allocate
void __RPC_FAR * __RPC_API midl_user_allocate (size_t cBytes);
-
cBytes
-
Specifies the count of bytes to allocate.
Example
void __RPC_FAR * __RPC_API midl_user_allocate(size_t cBytes)
{
return(malloc(cBytes));
}
Remarks
Both client applications and server applications must implement the midl_user_allocate function, unless you are compiling in OSF-compatibility (/osf) mode. Applications and generated stubs call midl_user_allocate when dealing with objects referenced by pointers:
-
The server application should call midl_user_allocate to allocate memory for the application — for example, when creating a new node.
-
The server stub calls midl_user_allocate when unmarshalling pointed-at data into the server address space.
-
The client stub calls midl_user_allocate when unmarshalling data from the server that is referenced by an out pointer. Note that for in, out, and unique pointers, the client stub calls midl_user_allocate only if the unique pointer value was NULL on input and changes to a non-null value during the call. If the unique pointer was non-null on input, the client stub writes the associated data into existing memory.
If midl_user_allocate fails to allocate memory, it must return a null pointer.
It is recommended that midl_user_allocate return a pointer that is 8 bytes aligned.
See Also
allocate, midl_user_free, pointers, ptr, ref, unique