diff options
Diffstat (limited to 'examples/DLL')
-rw-r--r-- | examples/DLL/.cvsignore | 2 | ||||
-rw-r--r-- | examples/DLL/DLL.mpc | 22 | ||||
-rw-r--r-- | examples/DLL/Magazine.h | 42 | ||||
-rw-r--r-- | examples/DLL/Makefile.am | 68 | ||||
-rw-r--r-- | examples/DLL/Newsweek.cpp | 48 | ||||
-rw-r--r-- | examples/DLL/Newsweek.h | 56 | ||||
-rw-r--r-- | examples/DLL/README | 47 | ||||
-rw-r--r-- | examples/DLL/Today.cpp | 48 | ||||
-rw-r--r-- | examples/DLL/Today.h | 57 | ||||
-rw-r--r-- | examples/DLL/test_dll.cpp | 79 |
10 files changed, 0 insertions, 469 deletions
diff --git a/examples/DLL/.cvsignore b/examples/DLL/.cvsignore deleted file mode 100644 index c2d3a626997..00000000000 --- a/examples/DLL/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -test_dll -test_dll diff --git a/examples/DLL/DLL.mpc b/examples/DLL/DLL.mpc deleted file mode 100644 index ca8d0a63009..00000000000 --- a/examples/DLL/DLL.mpc +++ /dev/null @@ -1,22 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Newsweek) : acelib { - Source_Files { - Newsweek.cpp - } -} - -project(*Today) : acelib { - Source_Files { - Today.cpp - } -} - -project(*Main) : aceexe { - exename = test_dll - after += DLL_Newsweek DLL_Today - Source_Files { - test_dll.cpp - } -} diff --git a/examples/DLL/Magazine.h b/examples/DLL/Magazine.h deleted file mode 100644 index 6555974494f..00000000000 --- a/examples/DLL/Magazine.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// =========================================================== -// -// -// = LIBRARY -// ACE_wrappers/examples/DLL -// -// = FILENAME -// Magazine.h -// -// = DESCRIPTION -// Abstract class whose methods are implemented by the derived -// classes. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// =========================================================== - -#ifndef MAGAZINE_H -#define MAGAZINE_H - -class Magazine -{ - // = TITLE - // This is an abstract class used in the DLL example. - // - // = DESCRIPTION - // This class simply is an inetrface which the derived classes - // will exploit. -public: - - virtual ~Magazine (void) {}; - // No-op virtual destructor. - - virtual void title (void) = 0; - // This method gives the title of the magazine. -}; - -#endif /* MAGAZINE_H */ diff --git a/examples/DLL/Makefile.am b/examples/DLL/Makefile.am deleted file mode 100644 index 6b93dd6fb36..00000000000 --- a/examples/DLL/Makefile.am +++ /dev/null @@ -1,68 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id$ -## -## This file was generated by MPC. Any changes made directly to -## this file will be lost the next time it is generated. -## -## MPC Command: -## /acebuilds/ACE_wrappers-repository/bin/mwc.pl -include /acebuilds/MPC/config -include /acebuilds/MPC/templates -feature_file /acebuilds/ACE_wrappers-repository/local.features -noreldefs -type automake -exclude build,Kokyu - -ACE_BUILDDIR = $(top_builddir) -ACE_ROOT = $(top_srcdir) - -## Makefile.DLL_Today.am -noinst_LTLIBRARIES = libDLL_Today.la - -libDLL_Today_la_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) - -libDLL_Today_la_SOURCES = \ - Today.cpp - -libDLL_Today_la_LIBADD = \ - $(top_builddir)/ace/libACE.la - -noinst_HEADERS = \ - Today.h - -## Makefile.DLL_Newsweek.am -noinst_LTLIBRARIES += libDLL_Newsweek.la - -libDLL_Newsweek_la_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) - -libDLL_Newsweek_la_SOURCES = \ - Newsweek.cpp - -libDLL_Newsweek_la_LIBADD = \ - $(top_builddir)/ace/libACE.la - -noinst_HEADERS += \ - Newsweek.h - -## Makefile.DLL_Main.am -noinst_PROGRAMS = test_dll - -test_dll_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) - -test_dll_SOURCES = \ - test_dll.cpp \ - Magazine.h \ - Newsweek.h \ - Today.h - -test_dll_LDADD = \ - $(top_builddir)/ace/libACE.la - -## Clean up template repositories, etc. -clean-local: - -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* - -rm -f gcctemp.c gcctemp so_locations *.ics - -rm -rf cxx_repository ptrepository ti_files - -rm -rf templateregistry ir.out - -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/examples/DLL/Newsweek.cpp b/examples/DLL/Newsweek.cpp deleted file mode 100644 index 5bb26def20e..00000000000 --- a/examples/DLL/Newsweek.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -#define ACE_BUILD_SVC_DLL - -#include "Newsweek.h" -#include "ace/Log_Msg.h" -#include "ace/svc_export.h" -#include "ace/OS_Memory.h" - -// Implementation of the abstract class method which describes -// the magazine. - -void Newsweek::title (void) -{ - ACE_DEBUG ((LM_DEBUG, - "Newsweek: Vol. 44923 Stardate: 12.3054\n")); -} - -void * -Newsweek::operator new (size_t bytes) -{ - return ::new char[bytes]; -} -#if defined (ACE_HAS_NEW_NOTHROW) -void * -Newsweek::operator new (size_t bytes, const ACE_nothrow_t&) -{ - return ::new (ACE_nothrow) char[bytes]; -} -#endif -void -Newsweek::operator delete (void *ptr) -{ - delete [] ((char *) ptr); -} - -// Returns the Newsweek class pointer. -// The ACE_BUILD_SVC_DLL and ACE_Svc_Export directives are necessary to -// take care of exporting the function for Win32 platforms. -extern "C" ACE_Svc_Export Magazine *create_magazine (void); - -Magazine * -create_magazine (void) -{ - Magazine *mag; - ACE_NEW_RETURN (mag, Newsweek, 0); - return mag; -} diff --git a/examples/DLL/Newsweek.h b/examples/DLL/Newsweek.h deleted file mode 100644 index 9f53b8c190a..00000000000 --- a/examples/DLL/Newsweek.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// =========================================================== -// -// = LIBRARY -// ACE_wrappers/examples/DLL -// -// = FILENAME -// Newsweek.h -// -// = DESCRIPTION -// This is a derived class from Magazine which is a magazine -// pertaining to news and information. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// =========================================================== - -#ifndef NEWSWEEK_H -#define NEWSWEEK_H - -#include "ace/os_include/os_stddef.h" -#include "ace/OS_Memory.h" -#include "Magazine.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -class Newsweek : public Magazine -{ - //= TITLE - // This is an derived class of Magazine. - // - //= DESCRIPTION - // Polymoriphism is exploited and an object pointer - // of Magazine is bound to the Newsweek object at runtime. -public: - - // This is the abstract class method which describes the magazine. - void title (void); - - // Overload the new/delete opertors so the object will be - // created/deleted using the memory allocator associated with the - // DLL/SO. - void *operator new (size_t bytes); -#if defined (ACE_HAS_NEW_NOTHROW) - // Overloaded new operator, nothrow_t variant. - void *operator new (size_t bytes, const ACE_nothrow_t&); -#endif - void operator delete (void *ptr); -}; - -# endif /* NEWSWEEK_H */ diff --git a/examples/DLL/README b/examples/DLL/README deleted file mode 100644 index 716b2c2b628..00000000000 --- a/examples/DLL/README +++ /dev/null @@ -1,47 +0,0 @@ -$Id$ - -DLL Test Example ----------------- - -This example deals with dynamically opening objects and accessing -methods from it. - -First, the pointer to the object is obtained by accessing symbol -of the function which can get the object pointer. Then the methods -in that library object is accessed. - -Here, the Magazine class is an abstract class with various magazine -objects like Newsweek and Today deriving form it. The libraries are -dynamically linked on demand. Thus, they can be changed on the fly -and accessed with its new changes. - -The ACE_DLL class used in this example is an helper class for -performing various operations on the library object. - -Compilation and Execution: -------------------------- - -1. On POSIX/UNIX platforms: - - First, build the test program, which you can do on UNIX as follows: - - % make - - Then run the test program: - - % test_dll - - to exercise the test. - - -2. On NT or any Win32 platform: - - Load Dll.dsw which contains Test_dll.dsp, Today.dsp and Newsweek.dsp. - - Build each dsp such that you build Test_dll.dsp last. - This is because the test_dll.exe will be using Today.dll and Newsweek.dll. - - Execute test_dll - - and watch it run! - diff --git a/examples/DLL/Today.cpp b/examples/DLL/Today.cpp deleted file mode 100644 index 036a7c82ccc..00000000000 --- a/examples/DLL/Today.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -#define ACE_BUILD_SVC_DLL - -#include "Today.h" -#include "ace/Log_Msg.h" -#include "ace/svc_export.h" -#include "ace/OS_Memory.h" - -// Implementation of the abstract class method which describes the -// magazine. - -void -Today::title (void) -{ - ACE_DEBUG ((LM_DEBUG, - "Today: XML Special Apr 02\n")); -} - -void * -Today::operator new (size_t bytes) -{ - return ::new char[bytes]; -} -#if defined (ACE_HAS_NEW_NOTHROW) -void * -Today::operator new (size_t bytes, const ACE_nothrow_t&) -{ - return ::new (ACE_nothrow) char[bytes]; -} -#endif -void -Today::operator delete (void *ptr) -{ - delete [] ((char *) ptr); -} - -// Returns the pointer to the Today class. -// The ACE_BUILD_SVC_DLL and ACE_Svc_Export directives are necessary to -// take care of exporting the function for Win32 platforms. -extern "C" ACE_Svc_Export Magazine *create_magazine (void); - -Magazine *create_magazine (void) -{ - Magazine *mag; - ACE_NEW_RETURN (mag, Today, 0); - return mag; -} diff --git a/examples/DLL/Today.h b/examples/DLL/Today.h deleted file mode 100644 index 19cce2317b5..00000000000 --- a/examples/DLL/Today.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// =========================================================== -// -// = LIBRARY -// ACE_wrappers/examples/DLL -// -// = FILENAME -// Today.h -// -// = DESCRIPTION -// This class denotes the Today magazine which is derived from -// Magazine. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// =========================================================== - -#ifndef TODAY_H -#define TODAY_H - -#include "ace/os_include/os_stddef.h" -#include "ace/OS_Memory.h" -#include "Magazine.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -class Today : public Magazine -{ - // = TITLE - // This is an derived class of Magazine. - // - // = DESCRIPTION - // Polymoriphism is exploited and an object pointer of Magazine - // is bound to the Today object at runtime. -public: - - // The virtual abstract class method which returns the title of the - // magazine. - void title (void); - - // Overload the new/delete opertors so the object will be - // created/deleted using the memory allocator associated with the - // DLL/SO. - void *operator new (size_t bytes); -#if defined (ACE_HAS_NEW_NOTHROW) - // Overloaded new operator, nothrow_t variant. - void *operator new (size_t bytes, const ACE_nothrow_t&); -#endif - void operator delete (void *ptr); -}; - -#endif /* TODAY_H */ diff --git a/examples/DLL/test_dll.cpp b/examples/DLL/test_dll.cpp deleted file mode 100644 index fce379da943..00000000000 --- a/examples/DLL/test_dll.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// $Id$ - -// This program tests out how the various objects can be loaded -// dynamically and method calls made on them. - -#include "Magazine.h" -#include "ace/DLL.h" -#include "ace/Auto_Ptr.h" -#include "ace/Log_Msg.h" - -ACE_RCSID(DLL, test_dll, "$Id$") - -typedef Magazine* (*Magazine_Creator) (void); - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - ACE_UNUSED_ARG (argc); - ACE_UNUSED_ARG (argv); - - ACE_DLL dll; - - int retval = dll.open (ACE_TEXT("./") ACE_DLL_PREFIX ACE_TEXT("Today")); - - if (retval != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.open"), - -1); - Magazine_Creator mc; - - mc = (Magazine_Creator) dll.symbol (ACE_TEXT("create_magazine")); - - if (mc == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.symbol"), - -1); - { - auto_ptr <Magazine> magazine (mc ()); - - magazine->title (); - } - - dll.close (); - - // The other library is now loaded on demand. - - retval = dll.open (ACE_TEXT("./") ACE_DLL_PREFIX ACE_TEXT("Newsweek")); - - if (retval != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.open"), - -1); - - mc = (Magazine_Creator) dll.symbol (ACE_TEXT("create_magazine")); - - if (mc == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.symbol"), - -1); - { - auto_ptr <Magazine> magazine (mc ()); - - magazine->title (); - } - - dll.close (); - - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class auto_ptr <Magazine>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate auto_ptr <Magazine> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ |