1 #include "DLL_Service.h"
3 #include "ace/Service_Gestalt.h"
4 #include "ace/Service_Config.h"
5 #include "ace/CORBA_macros.h"
6 #include "ace/OS_NS_unistd.h"
10 int ACE_TMAIN (int argc
, ACE_TCHAR
* argv
[])
16 ACE_Service_Gestalt
* gestalt
= 0;
17 ACE_NEW_NORETURN (gestalt
, ACE_Service_Gestalt ());
23 ACE_Intrusive_Auto_Ptr
<ACE_Service_Gestalt
> auto_clean (gestalt
);
25 // Without the following line, the application will crash while ACE
26 // is *cleaning* the ACE_Service_Config::global () object. We want
27 // to force all services to be loaded under this configuration.
28 ACE_Service_Config_Guard
guard (gestalt
);
30 if (module
.open (ACE_TEXT ("Bug_3499_Regression_ACE_DLL_TAO_Service")) == -1)
32 ACE_ERROR_RETURN ((LM_ERROR
,
33 ACE_TEXT ("failed to load ACE_DLL_TAO_Service\n")),
37 void * symbol
= module
.symbol (ACE_TEXT ("_make_ACE_DLL_TAO_Service"));
41 ACE_ERROR_RETURN ((LM_ERROR
,
42 ACE_TEXT ("failed to load symbol _make_ACE_DLL_TAO_Service\n")),
46 typedef ACE_DLL_Service
* (*factory_type
) ();
47 ptrdiff_t tmp_ptr
= reinterpret_cast <ptrdiff_t> (symbol
);
48 factory_type f
= reinterpret_cast <factory_type
> (tmp_ptr
);
50 ACE_DLL_Service
* svc
= (*f
) ();
54 // Initialize the service.
56 // If '-ORBGestalt CURRENT' does not appear in the command-line options,
57 // which is a fix for the bug in question, then the service will fail
58 // when trying to resolve to RootPOA.
60 ACE_TEXT ("(%t) %T - %M - initializing the loaded service\n")));
61 svc
->init (argc
, argv
);
63 // Sleep for a few seconds
65 ACE_TEXT ("(%t) %T - %M - sleeping for 5 seconds\n")));
68 // Finalize the service.
70 ACE_TEXT ("(%t) %T - %M - finalizing the service\n")));
73 // Destroy the service.
75 ACE_TEXT ("(%t) %T - %M - destroying the service\n")));
82 ACE_TEXT ("(%t) %T - %M - caught unknown exception\n")));