Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3KB

  1. // Copyright 2012-2022 David Robillard <d@drobilla.net>
  2. // SPDX-License-Identifier: ISC
  3. #ifndef PUGL_ATTRIBUTES_H
  4. #define PUGL_ATTRIBUTES_H
  5. // Public declaration scope
  6. #ifdef __cplusplus
  7. # define PUGL_BEGIN_DECLS extern "C" {
  8. # define PUGL_END_DECLS }
  9. #else
  10. # define PUGL_BEGIN_DECLS ///< Begin public API definitions
  11. # define PUGL_END_DECLS ///< End public API definitions
  12. #endif
  13. // Symbol exposed in the public API
  14. #ifndef PUGL_API
  15. # if defined(_WIN32) && !defined(PUGL_STATIC) && defined(PUGL_INTERNAL)
  16. # define PUGL_API __declspec(dllexport)
  17. # elif defined(_WIN32) && !defined(PUGL_STATIC)
  18. # define PUGL_API __declspec(dllimport)
  19. # elif defined(__GNUC__)
  20. # define PUGL_API __attribute__((visibility("default")))
  21. # else
  22. # define PUGL_API
  23. # endif
  24. #endif
  25. // GCC function attributes
  26. #if defined(__GNUC__)
  27. # define PUGL_CONST_FUNC __attribute__((const))
  28. # define PUGL_MALLOC_FUNC __attribute__((malloc))
  29. #else
  30. # define PUGL_CONST_FUNC ///< Only reads its parameters
  31. # define PUGL_MALLOC_FUNC ///< Allocates memory
  32. #endif
  33. /// A const function in the public API that only reads parameters
  34. #define PUGL_CONST_API PUGL_API PUGL_CONST_FUNC
  35. /// A malloc function in the public API that returns allocated memory
  36. #define PUGL_MALLOC_API PUGL_API PUGL_MALLOC_FUNC
  37. #endif // PUGL_ATTRIBUTES_H