PreviousNext

rpc_ss_swap_client_alloc_free(3rpc)

Exchanges the current memory allocation and freeing mechanism used by the client stubs with one supplied by the client

Used by client applications.

Synopsis

#include <dce/rpc.h>

void rpc_ss_swap_client_alloc_free(

idl_void_p_t (*p_allocate)(

idl_size_t size),

void (*p_free)(

idl_void_p_t ptr),

idl_void_p_t (**p_p_old_allocate)(

idl_size_t size),

void (**p_p_old_free)(

idl_void_p_t ptr)

);

Parameters

Input

p_allocate
Specifies a pointer to a routine that has the same procedure declaration as the malloc( ) routine and that is used for allocating client stub memory.

p_free
Specifies a pointer to a routine that has the same procedure declaration as the free( ) routine and that is used for freeing client stub memory.

Output

p_p_old_allocate
Specifies a pointer to a pointer to a routine that has the same procedure declaration as the malloc( ) routine. A pointer to the routine that was previously used to allocate client stub memory is returned in this parameter.

p_p_old_free
Specifies a pointer to a pointer to a routine that has the same procedure declaration as the free( ) routine. A pointer to the routine that was previously used to free client stub memory is returned in this parameter.

Note that in ANSI standard C environments, idl_void_p_t is defined as void * and in other environments is defined as char *.

Description
The rpc_ss_swap_client_alloc_free( ) routine exchanges the current client allocate and free mechanism used by the client stubs for one supplied by the caller. If it is appropriate for the client code called by an application to use a certain memory allocation and freeing mechanism, regardless of its caller's state, the client code can swap its own mechanism into place on entry, replacing its caller's mechanism. It can then swap the caller's mechanism back into place prior to returning.

For information about rules for using memory management routines, see the OSF DCE Application Development Guide - Core Components.

Return Values
An exception, rpc_x_no_memory, is returned when there is insufficient memory available to set up necessary data structures.

Errors

A representative list of errors that might be returned is not shown here. Refer to the OSF DCE Problem Determination Guide for complete descriptions of all error messages.

Related Information
Functions: rpc_ss_allocate(3rpc)

rpc_ss_free(3rpc)

rpc_ss_set_client_alloc_free(3rpc)

Books: OSF DCE Application Development Guide - Core Components