Hi,
A callback object (the first argument to the newCallback_XXX function) must always be an instance of a class derived from IceUtil::Shared, and therefore is a reference-counted object. As such, you must not delete this object manually. The overload that accepts a naked pointer is generated simply as a convenience. Without this overload, you would be forced to always pass a smart pointer, as shown below:
Code:
MyCallbackPtr cb = new MyCallback;
Callback_Hello_sayHelloPtr c = newCallback(cb, ...);
The overload allows the caller to pass an argument such as this (assuming this is an instance of IceUtil::Shared) or new MyCallback instead; note however that these arguments are used to construct smart pointers.
Ice's smart pointer API makes it possible for you to pass a pointer to a reference-counted object where a smart pointer is expected, causing the compiler to instantiate a temporary smart pointer when necessary. In the case of the newCallback_XXX template function, however, the compiler isn't clever enough to do this on its own so we had to generate the extra overload.
I hope that's a little clearer.
Regards,
Mark