template <class SVC_HANDLER> int ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh) { ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler"); // Open the shared library. ACE_SHLIB_HANDLE handle = ACE_OS::dlopen (this->dll_name_); // Extract the factory function. #if defined (ACE_OPENVMS) SVC_HANDLER *(*factory)(void) = (SVC_HANDLER *(*)(void)) ACE::ldsymbol (handle, this->factory_function_); #else SVC_HANDLER *(*factory)(void) = (SVC_HANDLER *(*)(void)) ACE_OS::dlsym (handle, this->factory_function_); #endif // Call the factory function to obtain the new SVC_Handler (should // use RTTI here when it becomes available...) SVC_HANDLER *svc_handler = 0; ACE_ALLOCATOR_RETURN (svc_handler, (*factory)(), -1); if (svc_handler != 0) { // Create an ACE_Service_Type containing the SVC_Handler and // insert into this->svc_rep_; ACE_Service_Type_Impl *stp = 0; ACE_NEW_RETURN (stp, ACE_Service_Object_Type (svc_handler, this->svc_name_), -1); ACE_Service_Type *srp = 0; ACE_NEW_RETURN (srp, ACE_Service_Type (this->svc_name_, stp, handle, 1), -1); if (srp == 0) { delete stp; errno = ENOMEM; return -1; } if (this->svc_rep_->insert (srp) == -1) return -1; // @@ Somehow, we need to deal with this->thr_mgr_... } sh = svc_handler; return 0; }
ACE_Service_Type_Impl * ACE_Service_Config::create_service_type_impl (const ACE_TCHAR *name, int type, void *symbol, u_int flags, ACE_Service_Object_Exterminator gobbler) { ACE_Service_Type_Impl *stp = 0; // Note, the only place we need to put a case statement. This is // also the place where we'd put the RTTI tests, if the compiler // actually supported them! switch (type) { case ACE_Service_Type::SERVICE_OBJECT: ACE_NEW_RETURN (stp, ACE_Service_Object_Type ((ACE_Service_Object *) symbol, name, flags, gobbler), 0); break; case ACE_Service_Type::MODULE: ACE_NEW_RETURN (stp, ACE_Module_Type (symbol, name, flags), 0); break; case ACE_Service_Type::STREAM: ACE_NEW_RETURN (stp, ACE_Stream_Type (symbol, name, flags), 0); break; default: ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("unknown case\n"))); break; } return stp; }