Archived

This forum has been archived. Please start a new discussion on GitHub.

how to implement ice client(server) in dll which can add various adapter dynamically

I want to implement a ice client(server) in dll which could add various adapter dynamically, each adapter also a dll.

ha, you may say "icebox and service do", but I have two problems:
1. I need the ice client(server) in dll, cause I want the GUI(MFC) application to load ice server in dll, so the application could reponse to various request through the ice server with various adapters loaded by the ice server. The application also could offer various request through the ice client(server).
2. If the application offer some twoway request through the ice client(server), how could application handle the callback? Different proxy may differ in callback signature.


For example:
ice client(server) in dll, may have the interface as follow
class BaseSink{
   virtual void        onError(string err); //invoked when servant error
   virtual void        onCallbackResponse(); //invoked when response to AMI proxy return
   virtual void        onCallbackIce_exception(const Ice::Exception& ex)  ;//invoked when ice_exception  AMI proxy return
}

class AdapterContainer{
   virtual Object * StarServant(string adapterName); //add the servant with the name
   virtual void        StopServant(string adapterName);
   virtual void       AddSink(BaseSink*); //so the ice client(server) can inform the main gui application
}


ice client(server) dll export the interface as follow
ICE_DECLSPEC_EXPORT AdapterContainer* create()
{
    return new AdapterContainerI;
}

Application Scene
1.Gui application invoke the AddSink, pass a BaseSink instance pointer,
2. the Gui application invoke the StartServant("Hello"), the ice client(server) dll create a communicator and adapter, then search and add the "Hello" servant to the adapter, return the servant proxy.
3. when you process a AMI through the proxy, and when response return, client(server) dll inform the gui application with BaseSink pointer


Problem is different servant may differ with response signature, one has a float out parameter, the other may has string out parameter. How could these various out parameter be passed to the gui application?
It looks like some container/component model, what do you suggest?