Free Electron
compat.h
1 #ifndef AL_COMPAT_H
2 #define AL_COMPAT_H
3 
4 #include "alstring.h"
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 #ifdef _WIN32
11 
12 #define WIN32_LEAN_AND_MEAN
13 #include <windows.h>
14 
15 WCHAR *strdupW(const WCHAR *str);
16 
17 /* Opens a file with standard I/O. The filename is expected to be UTF-8. */
18 FILE *al_fopen(const char *fname, const char *mode);
19 
20 #define HAVE_DYNLOAD 1
21 
22 #else
23 
24 #define al_fopen fopen
25 
26 #if defined(HAVE_DLFCN_H) && !defined(IN_IDE_PARSER)
27 #define HAVE_DYNLOAD 1
28 #endif
29 
30 #endif
31 
32 struct FileMapping {
33 #ifdef _WIN32
34  HANDLE file;
35  HANDLE fmap;
36 #else
37  int fd;
38 #endif
39  void *ptr;
40  size_t len;
41 };
42 struct FileMapping MapFileToMem(const char *fname);
43 void UnmapFileMem(const struct FileMapping *mapping);
44 
45 void GetProcBinary(al_string *path, al_string *fname);
46 
47 #ifdef HAVE_DYNLOAD
48 void *LoadLib(const char *name);
49 void CloseLib(void *handle);
50 void *GetSymbol(void *handle, const char *name);
51 #endif
52 
53 #ifdef __cplusplus
54 } /* extern "C" */
55 #endif
56 
57 #endif /* AL_COMPAT_H */