compat.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef AL_COMPAT_H
  2. #define AL_COMPAT_H
  3. #include "alstring.h"
  4. #ifdef _WIN32
  5. #define WIN32_LEAN_AND_MEAN
  6. #include <windows.h>
  7. WCHAR *strdupW(const WCHAR *str);
  8. /* Opens a file with standard I/O. The filename is expected to be UTF-8. */
  9. FILE *al_fopen(const char *fname, const char *mode);
  10. #define HAVE_DYNLOAD 1
  11. #else
  12. #define al_fopen fopen
  13. #if defined(HAVE_DLFCN_H) && !defined(IN_IDE_PARSER)
  14. #define HAVE_DYNLOAD 1
  15. #endif
  16. #endif
  17. struct FileMapping {
  18. #ifdef _WIN32
  19. HANDLE file;
  20. HANDLE fmap;
  21. #else
  22. int fd;
  23. #endif
  24. void *ptr;
  25. size_t len;
  26. };
  27. struct FileMapping MapFileToMem(const char *fname);
  28. void UnmapFileMem(const struct FileMapping *mapping);
  29. al_string GetProcPath(void);
  30. #ifdef HAVE_DYNLOAD
  31. void *LoadLib(const char *name);
  32. void CloseLib(void *handle);
  33. void *GetSymbol(void *handle, const char *name);
  34. #endif
  35. #ifdef __ANDROID__
  36. #define JCALL(obj, func) ((*(obj))->func((obj), EXTRACT_VCALL_ARGS
  37. #define JCALL0(obj, func) ((*(obj))->func((obj) EXTRACT_VCALL_ARGS
  38. /** Returns a JNIEnv*. */
  39. void *Android_GetJNIEnv(void);
  40. #endif
  41. #endif /* AL_COMPAT_H */