diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-11-29 16:45:23 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-11-29 16:45:23 +0000 |
commit | 25110dbdaf054e41b24c0f416006c2185d46bcd5 (patch) | |
tree | 0ff595ed5878b33c553e74dac32fa678af903938 /examples/DLL | |
parent | c6b92f97528ee27e734c73f6d5cf516499148d81 (diff) | |
download | ATCD-25110dbdaf054e41b24c0f416006c2185d46bcd5.tar.gz |
.
Diffstat (limited to 'examples/DLL')
-rw-r--r-- | examples/DLL/Newsweek.cpp | 5 | ||||
-rw-r--r-- | examples/DLL/README | 46 | ||||
-rw-r--r-- | examples/DLL/Today.cpp | 13 |
3 files changed, 41 insertions, 23 deletions
diff --git a/examples/DLL/Newsweek.cpp b/examples/DLL/Newsweek.cpp index 6aaf12ff441..f48d7700ea7 100644 --- a/examples/DLL/Newsweek.cpp +++ b/examples/DLL/Newsweek.cpp @@ -2,6 +2,9 @@ #include "Newsweek.h" +// @@ Kirthika, please see the comments in the Today.cpp file to see +// my recommendations for simplifying this stuff. + // This declaration necessary to get thi sworking on NT. #if defined (ACE_HAS_WIN32) @@ -20,6 +23,7 @@ extern "C" { // only need to export C interface if // Implementation of the abstract class method which describes // the magazine. + void Newsweek::title (void) { ACE_DEBUG ((LM_DEBUG, @@ -27,6 +31,7 @@ void Newsweek::title (void) } // Returns the Newsweek class pointer. + extern "C" Magazine *create_magazine (void) { diff --git a/examples/DLL/README b/examples/DLL/README index b66dce14595..716b2c2b628 100644 --- a/examples/DLL/README +++ b/examples/DLL/README @@ -1,47 +1,47 @@ -README: DLL Test Example --------------------------- +$Id$ + +DLL Test Example +---------------- This example deals with dynamically opening objects and accessing -methods from it. +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, it can be changed on the fly and accessed with its new changes. +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. -Execution: ---------- +Compilation and Execution: +------------------------- -*** On POSIX platforms, - First, build the test program, which you can do on UNIX as follows: +1. On POSIX/UNIX platforms: - % make + First, build the test program, which you can do on UNIX as follows: - Then run the test program: + % make - % test_dll + Then run the test program: - to exercise the test. + % test_dll + to exercise the test. -***On NT or any Win32 platform: - Load Dll.dsw which contains Test_dll.dsp, Today.dsp and Newsweek.dsp. +2. On NT or any Win32 platform: - 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. + Load Dll.dsw which contains Test_dll.dsp, Today.dsp and Newsweek.dsp. - Execute test_dll + 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. - and watch it happen! + Execute test_dll + and watch it run! ------------------------------------------------------------------------------------- diff --git a/examples/DLL/Today.cpp b/examples/DLL/Today.cpp index 01d139c72de..ccfa606eba0 100644 --- a/examples/DLL/Today.cpp +++ b/examples/DLL/Today.cpp @@ -6,19 +6,32 @@ #if defined (ACE_HAS_WIN32) #ifdef __cplusplus +// @@ Kirthika, this program will ALWAYS be compiled with a C++ +// compiler! Therefore, you can omit this __cplusplus #ifdef stuff... extern "C" { // only need to export C interface if // used by C++ source code #endif + // @@ Kirthika, please check to see which of the ACE macros, e.g., + // ACE_SVC_EXPORT, or ACE_EXPORT should be used here, rather than + // having to explicitly #ifdef your code you should use the ACE + // macros for this. __declspec( dllexport ) Magazine *create_magazine (void); #ifdef __cplusplus } #endif +// @@ Kirthika, please make sure that you always do something like this +// #endif /* ACE_HAS_WIN32 */ when you close a #ifdef block. However, +// in this case, I think you can remove the #if defined +// (ACE_HAS_WIN32) altogether since that'll be handled by the +// ACE_*_EXPORT macro! + #endif // Implementation of the abstract class method which describes the // magazine. + void Today::title (void) { |