2 //=============================================================================
4 * @file DLL_Test_Impl.cpp
6 * This test illustrates the use of <ACE_DLL> wrapper class.
8 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
10 //=============================================================================
13 #include "DLL_Test_Impl.h"
15 #include "ace/OS_Errno.h"
16 #include "ace/svc_export.h"
17 #include "ace/OS_NS_string.h"
19 Hello_Impl::Hello_Impl (void)
21 ACE_DEBUG ((LM_DEBUG
, "Hello_Impl::Hello_Impl\n"));
24 Hello_Impl::~Hello_Impl (void)
26 ACE_DEBUG ((LM_DEBUG
, "Hello_Impl::~Hello_Impl\n"));
30 Hello_Impl::say_next (void)
33 ACE_TEXT ("How are you?\n")));
37 Hello_Impl::new_info (void)
39 return ACE::strnew (ACE_TEXT ("Hello_Impl::new_info() allocated by ACE::strnew()"));
43 Hello_Impl::malloc_info (void)
45 return ACE_OS::strdup (ACE_TEXT ("Hello_Impl::new_info() allocated by ACE_OS::malloc()"));
49 Hello_Impl::operator new (size_t bytes
)
51 ACE_DEBUG ((LM_INFO
, "Hello_Impl::new\n"));
52 return ::new char[bytes
];
55 #if defined (ACE_HAS_NEW_NOTHROW)
56 /// Overloaded new operator, nothrow_t variant.
58 Hello_Impl::operator new (size_t bytes
, const ACE_nothrow_t
&nt
)
60 ACE_DEBUG ((LM_INFO
, "Hello_Impl::new\n"));
61 return ::new (nt
) char[bytes
];
64 #if !defined (ACE_LACKS_PLACEMENT_OPERATOR_DELETE)
66 Hello_Impl::operator delete (void *ptr
, const ACE_nothrow_t
&) throw ()
68 ACE_DEBUG ((LM_INFO
, "Hello_Impl::delete\n"));
69 ::delete [] static_cast<char *> (ptr
);
71 #endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */
73 #endif /* ACE_HAS_NEW_NOTHROW */
76 Hello_Impl::operator delete (void *ptr
)
78 ACE_DEBUG ((LM_INFO
, "Hello_Impl::delete\n"));
79 ::delete [] static_cast<char *> (ptr
);
82 extern "C" ACE_Svc_Export Hello
*
87 ACE_NEW_RETURN (hello
,
94 class Static_Constructor_Test
97 Static_Constructor_Test (void)
100 "Static_Constructor_Test::Static_Constructor_Test\n"));
102 ~Static_Constructor_Test (void)
104 ACE_DEBUG ((LM_DEBUG
,
105 "Static_Constructor_Test::~Static_Constructor_Test\n"));
109 static Static_Constructor_Test the_instance
;
111 // --------------------------------------------------------
124 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("child called\n")));
127 // --------------------------------------------------------
131 extern "C" ACE_Svc_Export
int
132 dynamic_cast_test (Parent
*target
)
135 c
= dynamic_cast<Child
*> (target
);
136 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("dynamic_cast_test: parent %@; child %@\n"),
138 return target
== c
? 0 : -1;