blob: 3526af927a96a701e18841210a0f6eb53341405b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
$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. Win32 platforms:
Load DLL.sln which contains DLL_Main.vcproj, DLL_Today.vcproj and DLL_Newsweek.vcproj.
Build each vcproj such that you build DLL_Main.vcproj last.
This is because the test_dll.exe will be using Today.dll and Newsweek.dll.
Execute test_dll
and watch it run!
|