How Memory Is Allocated and Deallocated

Typically, stub code generated by the MIDL compiler calls user-supplied functions to allocate and free memory. These functions, named midl_user_allocate and midl_user_free, must be supplied by the developer and linked with the application.

All applications must supply implementations of midl_user_allocate and midl_user_free, even though the names of these functions may not appear explicitly in the stubs. The only exception is if you are compiling in OSF-compatibility (/osf) mode.

These user-supplied functions must match a specific, defined, function prototype, but otherwise can be implemented in any way that is convenient or useful for the application.