summaryrefslogtreecommitdiff
path: root/ace/DLL.h
blob: cc00d5b392414c68c19c7b1f86f59bd17938466a (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    ace
//
// = FILENAME
//    DLL.h
//
// = AUTHOR
//    Kirthika Parameswaran <kirthika@cs.wustl.edu>
//
// ============================================================================

#ifndef ACE_DLL_H
#define ACE_DLL_H

#include "ace/OS.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

class ACE_Export ACE_DLL
{
  // = TITLE
  //    Provides an abstract interface for handling various DLL
  //    operations.
  //
  // = DESCRIPTION
  //   This class is an wrapper over the various methods for utilizing
  //   a dynamically linked library (DLL). The operations like open,
  //   close, symbol have been implemented to help opening and
  //   extracting symbol information from a DLL.
public:
  // = Initialization and termination methods.

  ACE_DLL (ACE_DL_TYPE dll_name = 0,
           int mode = ACE_DEFAULT_SHLIB_MODE);
  // Another way of initialisation wherein the user gives the 
  // library name and mode and thus the opening of the library is
  // done implicitly along with the auto_close feature.
 
  ~ACE_DLL (void);
  // Called when object is destroyed.

  int open (ACE_DL_TYPE dll_name, 
            int mode = ACE_DEFAULT_SHLIB_MODE);
  // This is the library open operation which uses ACE_SHLIB_HANDLE
  // object internally to open the library.  The default mode is
  // RTLD_LAZY which means that the identifier symbols are loaded but
  // not the symbols for the functions.
  // They are loaded dynamically on need.
  // The other modes include:
  //  RTLD_NOW     All necessary relocations are performed when the
  //               object is first loaded.
  //  RTLD_GLOBAL  The object symbols are made available for the
  //               relocation processing of any other object. 
  
  void *symbol (ACE_DL_TYPE sym_name);
  // The symbol reference is returned corresponding to the symbol
  // name.

  int close (void);
  // The library is closed.

  char *error (void);
  // The error on any of the dl-procedures.

  ACE_SHLIB_HANDLE get_handle (int orphan_mode);
  // Return the handle to the user either forever or for temporary use.

private:
  ACE_SHLIB_HANDLE handle_;
  // This is the reference to the library.
  
  int close_mode_;
  // This is the flag representing the special close_on_destruction
  // feature.
};

#endif /* ACE_DLL_H */