compat.h 982 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 __cplusplus
  39. } /* extern "C" */
  40. #endif
  41. #endif /* AL_COMPAT_H */