Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXDLL.h
1 /********************************************************************************
2 * *
3 * D y n a m i c L i n k L i b r a r y S u p p o r t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2002,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXDLL_H
22 #define FXDLL_H
23 
24 namespace FX {
25 
26 
31 class FXAPI FXDLL {
32 private:
33  void *hnd;
34 public:
35 
37  FXDLL():hnd(nullptr){}
38 
40  FXDLL(void *h):hnd(h){}
41 
43  FXDLL(const FXDLL& org):hnd(org.hnd){}
44 
46  FXString name() const;
47 
49  void* handle() const { return hnd; }
50 
52  FXbool loaded() const { return hnd!=nullptr; }
53 
55  FXbool load(const FXString& nm);
56 
58  void unload();
59 
61  void* address(const FXchar* sym) const;
62  void* address(const FXString& sym) const;
63 
65  static FXString symbol(void *addr);
66 
68  static FXString name(void *addr);
69 
71  static FXDLL dll(void* addr);
72 
74  static FXDLL dll();
75 
77  static FXString error();
78  };
79 
80 
85 class FXAPI FXAUTODLL : public FXDLL {
86 private:
87  FXAUTODLL(const FXAUTODLL&);
88  FXAUTODLL &operator=(const FXAUTODLL&);
89 public:
90 
92  FXAUTODLL(const FXString& nm);
93 
95  ~FXAUTODLL();
96  };
97 
98 }
99 
100 #endif
FXDLL()
Construct with no handle.
Definition: FXDLL.h:37
Auto DLL wraps a library module handle but also owns it; thus, the library module will automatically ...
Definition: FXDLL.h:85
void * handle() const
Return library module handle.
Definition: FXDLL.h:49
FXDLL(void *h)
Construct with existing handle.
Definition: FXDLL.h:40
Definition: FX4Splitter.h:28
FXbool loaded() const
True if library was loaded.
Definition: FXDLL.h:52
FXDLL(const FXDLL &org)
Construct copy from original.
Definition: FXDLL.h:43
Wrap library module handle to allow various operations on libraries to be performed.
Definition: FXDLL.h:31
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp