> Yeah. Now that I understand more about COM and IDispatch 
> things are going smoothly.
> Question: how do I close a connection to the COM object?

in general you simply call ->release() on the component. if you call
release() as often as addref() (note that addref() is called implicitly
on instanciation) the component should be closed by windows. windows 2k
can also pool instances of components (i don't know if this is the case
for dcom), so if you release an instance windows will still keep it
alive and assign it to the next process that requests it.

in php references are counted internally and each php-thread calls the
components addref() only once, regardless how often you call
$obj->addref(); so all references will be released when the script
terminates (this should prevent user errors) so a component gets closed
when the script shuts down (beside the underlying instance pooling) so
you don't need to close the connection by hand.

if you have to close components in a specified order or if script
execution takes very long you can simply call

$obj = null; // note that $obj = null; alone wouldn't close the
connection immediately, because the garbage collector
             // runs very seldom. most of the time $obj would get
released on script shutdown.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to