I have a very simple Ice-based Windows service that starts just fine:
C:\ICT\bin>ICTViewerBridge.exe --start ICTViewerBridge
Service start pending.
Service is running.
However, when I try to stop it, I see in the console:
C:\ICT\bin>ICTViewerBridge.exe --stop ICTViewerBridge
Stop request sent to service.
Current state: 4
Exit code: 0
Service specific exit code: 0
Check point: 0
Wait hint: 0
and a message box pops up saying:
Debug Error!
Program C:\ICT\bin\ICTViewerBridge.exe
DAMAGE: after Normal block (#219) at 0x00397538
Things are slightly better if I compile in Release mode; I'm usually
able to stop the service with no errors. But occasionally I get a
msgbox saying:
The instruction at "0x0012e48c" referenced memory at "0x00000000".
The memory could not be "written".
Did I do something wrong? (See attached source...)
TIA,
Dave
----------
#include <ViewerBridgeImpl.h>
#include <Ice/ice.h>
#include <Ice/Service.h>
using namespace ICT;
class ViewerService: public Ice::Service
{
private:
Ice::ObjectAdapterPtr adapter_;
protected:
virtual bool start( int argc, char* argv[] );
};
bool ViewerService::start( int argc, char* argv[] )
{
// Create an 'adapter' for the server
adapter_ = communicator()->createObjectAdapterWithEndpoints(
"ICTViewerBridgeAdapter", "default -p 48105" );
// Create/add a servant implementing the ICTViewerBridge interface
Ice::ObjectPtr obj = new ViewerBridgeImpl;
adapter_->add( obj, Ice::stringToIdentity( "ICTViewerBridge" ) );
adapter_->activate();
return true;
}
int main(int argc, char* argv[])
{
ViewerService svc;
return svc.main(argc, argv);
}

Reply With Quote