Destroying objects via a proxy

DSOM provides means for deleting remote objects via their proxies. For example, if somFree is invoked on a proxy, the somFree call gets forwarded directly to the target object, just like any other target method call. For example,

_somFree(car);

frees the remote car. Note that, by default, invoking somFree on the proxy does not free the proxy, only the remote object. However, the following call can be issued as part of a client-program initialization, so that invoking somFree on a proxy frees both the remote object and the proxy:

   __set_somd21somFree(SOMD_ObjectMgr, ev, TRUE);

All subsequent invocations of somFree on a proxy object will result in both the remote object and the proxy being freed.

To be explicit about whether the proxy or the remote object is being deleted, the methods somdTargetFree and somdProxyFree, defined on proxies, can be used:

_somdTargetFree(car, &ev);
frees the remote "Car" (but not the proxy) and
_somdProxyFree(car, &ev);

frees the proxy (but not the remote "Car").

Note: CORBA specifies a third method for deleting object references. (Proxies are a specialized type of object reference.) The method

        _release(car, &ev);

deletes the proxy (but not the target object).