compat.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef AL_COMPAT_H
  2. #define AL_COMPAT_H
  3. #include "AL/al.h"
  4. #ifdef _WIN32
  5. #define WIN32_LEAN_AND_MEAN
  6. #include <windows.h>
  7. typedef DWORD althread_key_t;
  8. int althread_key_create(althread_key_t *key, void (*callback)(void*));
  9. int althread_key_delete(althread_key_t key);
  10. void *althread_getspecific(althread_key_t key);
  11. int althread_setspecific(althread_key_t key, void *val);
  12. typedef LONG althread_once_t;
  13. #define ALTHREAD_ONCE_INIT 0
  14. void althread_once(althread_once_t *once, void (*callback)(void));
  15. inline int alsched_yield(void)
  16. { SwitchToThread(); return 0; }
  17. WCHAR *strdupW(const WCHAR *str);
  18. #define HAVE_DYNLOAD 1
  19. #else
  20. #include <pthread.h>
  21. typedef pthread_mutex_t CRITICAL_SECTION;
  22. void InitializeCriticalSection(CRITICAL_SECTION *cs);
  23. void DeleteCriticalSection(CRITICAL_SECTION *cs);
  24. void EnterCriticalSection(CRITICAL_SECTION *cs);
  25. void LeaveCriticalSection(CRITICAL_SECTION *cs);
  26. ALuint timeGetTime(void);
  27. void Sleep(ALuint t);
  28. #define althread_key_t pthread_key_t
  29. #define althread_key_create pthread_key_create
  30. #define althread_key_delete pthread_key_delete
  31. #define althread_getspecific pthread_getspecific
  32. #define althread_setspecific pthread_setspecific
  33. #define althread_once_t pthread_once_t
  34. #define ALTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
  35. #define althread_once pthread_once
  36. #define alsched_yield sched_yield
  37. #if defined(HAVE_DLFCN_H)
  38. #define HAVE_DYNLOAD 1
  39. #endif
  40. #endif
  41. #ifdef HAVE_DYNLOAD
  42. void *LoadLib(const char *name);
  43. void CloseLib(void *handle);
  44. void *GetSymbol(void *handle, const char *name);
  45. #endif
  46. #endif /* AL_COMPAT_H */