compat.h 1.2 KB

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