The CORBA_Environment_alloc() function is the function used to allocate and initiate the CORBA_Environment structure.
CORBA_Environment *CORBA_Environment_alloc(inbufsz, outbufsz)
int inbufsz;
int outbufsz;
This funtion is used to create and initiate the CORBA_Environment
structure. In particular, it is used to dynamically allocate a CORBA_Environment
structure and set the default values for the structure's fields.
inbufsize is the wished size of input buffer.
outbufsize is the wished size of output buffer.
CORBA_Environment is the CORBA 2.0 state structure used by the generated stub.
This function will set all needed default values and allocate buffers equal to the values passed, but will not allocate space for the _to_pid and _from_pid fields.
To free the space allocated by CORBA_Environment_alloc/2 :
Here is the complete definition of the CORBA_Environment structure, defined in file ic.h :
/* Environment definition */ typedef struct { /*----- CORBA compatibility part ---------------------------------------*/ CORBA_exception_type _major; /* Exception tag, initially set to CORBA_NO_EXCEPTION */ /*----- External Implementation part - initiated by the user -----------*/ int _fd; /* File descriptor */ int _inbufsz; /* Size of input buffer */ char *_inbuf; /* Pointer to always dynamically allocated buffer for input */ int _outbufsz; /* Size of output buffer */ char *_outbuf; /* Pointer to always dynamically allocated buffer for output */ int _memchunk; /* Size of memory chunks in bytes, used for increasing the output buffer, set to >= 32, should be around >= 1024 for performance reasons */ char _regname[256]; /* Pointer for registered name */ erlang_pid *_to_pid; /* Process identity for caller */ erlang_pid *_from_pid; /* Process identity for callee */ /*----- Internal Implementation part - used by the server/client -------*/ int _iin; /* Index for input buffer */ int _iout; /* Index for output buffer */ char _operation[256]; /* Pointer for operation name */ int _received; /* Used to count parameters */ erlang_pid _caller; /* Used to identify the caller */ erlang_ref _unique; /* Used to identify the call */ CORBA_char *_exc_id; /* Exception id field */ void *_exc_value; /* Exception value field */ } CORBA_Environment;
Remember to set the field values _fd , _regname , *_to_pid and/or *_from_pid to the appropriate application values. These are not automatically set by the stubs. |
Never assign static buffers to the buffer pointers, never set the _memchunk field to a value less than 32. |
ic(3)