ScummVM API documentation
dcloader.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef DC_DCLOADER_H
23 #define DC_DCLOADER_H
24 
25 #include "dc.h"
26 
27 #define MAXDLERRLEN 80
28 
29 class DLObject {
30  private:
31  char *errbuf; /* For error messages, at least MAXDLERRLEN in size */
32 
33  void *segment, *symtab;
34  char *strtab;
35  int symbol_cnt;
36  void *dtors_start, *dtors_end, *dso_handle;
37 
38  void seterror(const char *fmt, ...);
39  void unload();
40  bool relocate(int fd, unsigned long offset, unsigned long size);
41  bool load(int fd);
42 
43  public:
44  bool open(const char *path);
45  bool close();
46  void *symbol(const char *name);
47  void discard_symtab();
48 
49  DLObject(char *_errbuf = NULL) : errbuf(_errbuf), segment(NULL),symtab(NULL),
50  strtab(NULL), symbol_cnt(0), dtors_start(NULL), dtors_end(NULL) {}
51 };
52 
53 #define RTLD_LAZY 0
54 
55 extern "C" {
56  void *dlopen(const char *filename, int flags);
57  int dlclose(void *handle);
58  void *dlsym(void *handle, const char *symbol);
59  const char *dlerror();
60  void dlforgetsyms(void *handle);
61 }
62 
63 #endif
Definition: dcloader.h:29