Document return values
[ACE_TAO.git] / ACE / ace / OS_main.cpp
blob1fbacb1ba93108e5750075c10907bff1a8d94335
1 #include "ace/OS_main.h"
3 #if !defined (ACE_DOESNT_DEFINE_MAIN)
5 #if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) && !defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER)
7 #include "ace/Init_ACE.h"
9 # if !defined (ACE_HAS_MINIMAL_ACE_OS)
10 # include "ace/Object_Manager.h"
11 # endif /* ! ACE_HAS_MINIMAL_ACE_OS */
13 // Rename "main ()" on platforms that don't allow it to be called "main ()".
15 // Also, create ACE_Object_Manager static instance(s) in "main ()".
16 // ACE_MAIN_OBJECT_MANAGER defines the ACE_Object_Manager(s) that will
17 // be instantiated on the stack of main (). Note that it is only used
18 // when compiling main (): its value does not affect the contents of
19 // ace/OS.o.
20 # if !defined (ACE_MAIN_OBJECT_MANAGER)
21 # define ACE_MAIN_OBJECT_MANAGER \
22 ACE_OS_Object_Manager ace_os_object_manager; \
23 ACE_Object_Manager ace_object_manager;
24 # endif /* ! ACE_MAIN_OBJECT_MANAGER */
26 # if !defined (ACE_WIN32)
28 # if !(defined (ACE_VXWORKS) && !defined (__RTP__))
29 /* forward declaration */
30 extern int ace_main_i (int, char *[]);
31 # endif
33 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
35 # if defined (ACE_VXWORKS) && !defined (__RTP__)
36 ace_main_proc_ptr vx_ace_main_i_ptr = 0;
38 int ace_os_main_i (int argc, char *argv[]) /* user's entry point, e.g., main */
40 ACE_MAIN_OBJECT_MANAGER
41 return vx_ace_main_i_ptr ? (*vx_ace_main_i_ptr) (argc, argv) : (-1); /* what the user calls "main" */
43 # else /* !ACE_VXWORKS && !__RTP__ */
44 ACE_Export int
45 ace_os_main_i (int argc, char *argv[]) /* user's entry point, e.g., main */
47 ACE_MAIN_OBJECT_MANAGER
48 return ace_main_i (argc, argv); /* what the user calls "main" */
50 # endif
52 ACE_END_VERSIONED_NAMESPACE_DECL
54 # else
56 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
58 # if defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
59 int ACE_Main_Base::run (int argc, ACE_TCHAR *argv[])
61 return this->run_i (argc, argv);
64 ACE_Export int
65 ace_os_wmain_i (ACE_Main_Base &mbase, int argc, ACE_TCHAR *argv[]) /* user's entry point, e.g., main */
67 ACE_MAIN_OBJECT_MANAGER
68 return mbase.run (argc, argv); /* what the user calls "main" */
70 # else /* ! (ACE_WIN32 && ACE_USES_WCHAR) */
72 ACE_Main_Base::ACE_Main_Base ()
74 ACE::init ();
77 ACE_Main_Base::~ACE_Main_Base ()
79 ACE::fini ();
82 int ACE_Main_Base::run (int argc, char *argv[])
84 return this->run_i (argc, argv);
87 ACE_Export int
88 ace_os_main_i (ACE_Main_Base &mbase, int argc, char *argv[]) /* user's entry point, e.g., main */
90 ACE_MAIN_OBJECT_MANAGER
91 return mbase.run (argc, argv); /* what the user calls "main" */
93 # endif /* ACE_WIN32 && ACE_USES_WCHAR */
95 ACE_END_VERSIONED_NAMESPACE_DECL
97 # endif /* !ACE_WIN32 */
99 #endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */
101 #endif /* ACE_DOESNT_DEFINE_MAIN */