Add some helper wrappers to mmap files
[openal-soft.git] / Alc / compat.h
blob114fc655d7553ec4577956d822669a84f8337a7e
1 #ifndef AL_COMPAT_H
2 #define AL_COMPAT_H
4 #include "alstring.h"
6 #ifdef _WIN32
8 #define WIN32_LEAN_AND_MEAN
9 #include <windows.h>
11 WCHAR *strdupW(const WCHAR *str);
13 /* Opens a file with standard I/O. The filename is expected to be UTF-8. */
14 FILE *al_fopen(const char *fname, const char *mode);
16 #define HAVE_DYNLOAD 1
18 #else
20 #define al_fopen fopen
22 #if defined(HAVE_DLFCN_H) && !defined(IN_IDE_PARSER)
23 #define HAVE_DYNLOAD 1
24 #endif
26 #endif
28 struct FileMapping {
29 #ifdef _WIN32
30 HANDLE file;
31 HANDLE fmap;
32 #else
33 int fd;
34 #endif
35 void *ptr;
36 size_t len;
38 struct FileMapping MapFileToMem(const char *fname);
39 void UnmapFileMem(const struct FileMapping *mapping);
41 al_string GetProcPath(void);
43 #ifdef HAVE_DYNLOAD
44 void *LoadLib(const char *name);
45 void CloseLib(void *handle);
46 void *GetSymbol(void *handle, const char *name);
47 #endif
49 #endif /* AL_COMPAT_H */