The ability to change memory through pointers often requires that the server and the client allocate enough memory for the elements in the array.
Whenever a stub must allocate or free memory, it calls run-time library functions that in turn call the functions midl_user_allocate and midl_user_free. These functions are not included as part of the run-time library. You need to write your own versions of these functions and link them with your application. In this way, you can decide how to manage memory. (The exception is if you are compiling your IDL file in OSF-compatibility (/osf) mode, in which case you do not need to implement these functions)
You must write these functions to the following prototypes:
void __RPC_FAR * __RPC_API midl_user_allocate(size_t len)
void __RPC_API midl_user_free(void __RPC_FAR * ptr)
For example, the versions of these functions for an application can simply call standard library functions:
void __RPC_FAR * __RPC_API midl_user_allocate(size_t len)
{
return(malloc(len));
}
void __RPC_API midl_user_free(void __RPC_FAR * ptr)
{
free(ptr);
}