2-54
SOMobjects Base Toolkit: Programmer’s Reference Manual
free_memory Method
Purpose
Frees any dynamically allocated out-arg memory associated with the specified list.
IDL Syntax
ORBStatus free_memory ( );
Description
The free_memory method frees any dynamically allocated out-arg memory associated with
the specified list, without freeing the list object itself. This would be useful when invoking a
DII request multiple times with the same NVList.
Parameters
receiver A pointer to the NVList object whose out-arg memory is to be freed.
env A pointer to the Environment structure for the method caller.
Return Value
The free_memory method returns an ORBStatus value representing the return code from
the operation.
Example
#include <somd.h>
#include <repostry.h>
#include <intfacdf.h>
#include <foo.h> /* provided by user */
/* assume following method declaration in interface Foo:
* long methodLong (in long inLong,inout long inoutLong);
* then the following code repeatedly invokes a request:
* result = methodLong(fooObj, &ev, 100, 200);
* using the DII.
*/
Environment ev;
NVList arglist;
NamedValue result;
long rc;
Foo fooObj;
Request reqObj;
/* See example code for ”invoke” to see how the argList is built */
/* Create the Request, reqObj */
rc = _create_request(fooObj, &ev, (Context *)NULL, ”methodLong”,
arglist, &result, &reqObj, (Flags)0);
/* Repeatedly invoke the Request */
for (;;) {
rc = _invoke(reqObj, &ev, (Flags)0);
...
rc= _free_memory(arglist,&ev); /* free out args */
}
...
Komentarze do niniejszej Instrukcji