Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dll_init.h « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ca2cc2c203b6499b3aedf1b7f350855384126df4 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* dll_init.h

   Copyright 1998 Cygnus Solutions

This file is part of Cygwin.

This software is a copyrighted work licensed under the terms of the
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
details. */

//-----------------------------------------------------------------------------
// list of loaded DLL (used by fork & init)
class DllList
{
public:
  static DllList& the ();

  // return dll index used for freeDll
  int recordDll (HMODULE, per_process*);
  void detachDll (int dll_index);

  // called after initialization of main module in dll_crt0
  void initAll ();

  // global destructors of loaded dlls
  void doGlobalDestructorsOfDlls ();

  // number of dlls dlopened
  int numberOfOpenedDlls ();

  // boolean to determine if forked process must reload dlls opened with
  // LoadLibrary or dlopen ...
  // default = 0 (FALSE)
  int forkeeMustReloadDlls ();
  void forkeeMustReloadDlls (int);

  void forkeeLoadDlls ();

  // set name of current library opened with dlopen
  void currentDlOpenedLib (const char*);
};

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

class DllListIterator
{
  int _type;
  int _index;

protected:
  DllListIterator (int type);
  int index () const { return _index; }

public:
  virtual ~DllListIterator();

  int ok() { return _index!=-1; }
  void operator++ ();
  void operator++ (int) { operator++ (); }
  operator per_process* ();
};

//-----------------------------------------------------------------------------

class LinkedDllIterator : public DllListIterator
{
public:
  LinkedDllIterator ();
  ~LinkedDllIterator ();
};

//-----------------------------------------------------------------------------

class LoadedDllIterator : public DllListIterator
{
public:
  LoadedDllIterator ();
  ~LoadedDllIterator ();
};

//-----------------------------------------------------------------------------

#define DO_LINKED_DLL(var)						      \
{									      \
LinkedDllIterator iterator;						      \
while (iterator.ok ())							      \
{									      \
  per_process *var = (per_process *) iterator;

#define DO_LOADED_DLL(var)						      \
{									      \
LoadedDllIterator iterator;						      \
while (iterator.ok ())							      \
{									      \
  per_process *var = (per_process *) iterator;

#define DLL_DONE							      \
  iterator++;								      \
}									      \
}