x-resources.h 931 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef X_RESOURCES_H
  2. #define X_RESOURCES_H
  3. #ifdef __APPLE__
  4. #include <mach-o/getsect.h>
  5. #define EXTLD(NAME) \
  6. extern const unsigned char _section$__DATA__ ## NAME [];
  7. #define LDVAR(NAME) _section$__DATA__ ## NAME
  8. #define LDLEN(NAME) (getsectbyname("__DATA", "__" #NAME)->size)
  9. #elif (defined __WIN32__) /* mingw */
  10. #define EXTLD(NAME) \
  11. extern const unsigned char binary_ ## NAME ## _start[]; \
  12. extern const unsigned char binary_ ## NAME ## _end[];
  13. #define LDVAR(NAME) \
  14. binary_ ## NAME ## _start
  15. #define LDLEN(NAME) \
  16. ((binary_ ## NAME ## _end) - (binary_ ## NAME ## _start))
  17. #else /* gnu/linux ld */
  18. #define EXTLD(NAME) \
  19. extern const unsigned char _binary_ ## NAME ## _start[]; \
  20. extern const unsigned char _binary_ ## NAME ## _end[];
  21. #define LDVAR(NAME) \
  22. _binary_ ## NAME ## _start
  23. #define LDLEN(NAME) \
  24. ((_binary_ ## NAME ## _end) - (_binary_ ## NAME ## _start))
  25. #endif
  26. #endif /* X_RESOURCES_H */