Merge pull request #204 from jhasse/android-byte-order
[openal-soft.git] / Alc / compat.h
blob093184c816fc4a14835c66907e05068575ecd8cb
1 #ifndef AL_COMPAT_H
2 #define AL_COMPAT_H
4 #include "alstring.h"
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 #ifdef _WIN32
12 #define WIN32_LEAN_AND_MEAN
13 #include <windows.h>
15 WCHAR *strdupW(const WCHAR *str);
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);
20 #define HAVE_DYNLOAD 1
22 #else
24 #define al_fopen fopen
26 #if defined(HAVE_DLFCN_H) && !defined(IN_IDE_PARSER)
27 #define HAVE_DYNLOAD 1
28 #endif
30 #endif
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;
42 struct FileMapping MapFileToMem(const char *fname);
43 void UnmapFileMem(const struct FileMapping *mapping);
45 void GetProcBinary(al_string *path, al_string *fname);
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
53 #ifdef __ANDROID__
54 #define JCALL(obj, func) ((*(obj))->func((obj), EXTRACT_VCALL_ARGS
55 #define JCALL0(obj, func) ((*(obj))->func((obj) EXTRACT_VCALL_ARGS
57 /** Returns a JNIEnv*. */
58 void *Android_GetJNIEnv(void);
59 #endif
61 #ifdef __cplusplus
62 } /* extern "C" */
63 #endif
65 #endif /* AL_COMPAT_H */