Repository: libsdl-org/SDL
File: include/SDL3/SDL_dlopennote.h (C/C++)

Code before:
  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.
*/

/**
 * # CategoryDLOpenNotes
 *
 * This header allows you to annotate your code so external tools know about
 * optional shared library dependencies.
 *
 * You can specify optional dependencies like this:
 *
 * ```c
 * SDL_ELF_NOTE_DLOPEN(
 *     "png",
 *     "Support for loading PNG images using libpng (required for APNG)",
 *     SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
 *     "libpng12.so.0"
 * );
 *
 * If you determine that your toolchain doesn't support dlopen notes, you can
 * disable this feature by defining `SDL_DISABLE_DLOPEN_NOTES`. You can use this
 * CMake snippet to check for support:
 *
 * ```
 *  set(CHECK_ELF_DLNOTES_SRC [==[
 *  #ifndef __ELF__
 *    ELF DL notes is only supported on ELF platforms
 *  #endif
 *  __attribute__ ((used,aligned(4),section(".note.dlopen"))) static const struct {
 *    struct { int a; int b; int c; } hdr; char name[4]; __attribute__((aligned(4))) char json[24];
 *  } dlnote = { { 4, 0x407c0c0aU, 16 }, "FDO", "[\\"a\\":{\\"a\\":\\"1\\",\\"b\\":\\"2\\"}]" };
 *  int main(int argc, char *argv[]) {
 *    return argc + dlnote.hdr.a;
 *  }
 *  ]==])
 *  check_c_source_compiles("${CHECK_ELF_DLNOTES_SRC}" COMPILER_SUPPORTS_ELFNOTES)
 *  if(NOT COMPILER_SUPPORTS_ELFNOTES)
 *    set(SDL_DISABLE_DLOPEN_NOTES TRUE)
 *  endif()
 * ```
 *
 * ```
 */

#ifndef SDL_dlopennote_h

Review comment (suggestion):
```suggestion
 * );
 * ```
 *
 * If you determine that your toolchain doesn't support dlopen notes, you can
```

Code after:
  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.
*/

/* WIKI CATEGORY: DlopenNotes */

/**
 * # CategoryDlopenNotes
 *
 * This header allows you to annotate your code so external tools know about
 * dynamic shared library dependencies.
 *
 * If you determine that your toolchain doesn't support dlopen notes, you can
 * disable this feature by defining `SDL_DISABLE_DLOPEN_NOTES`. You can use this
 * CMake snippet to check for support:
 *
 * ```cmake
 *  set(CHECK_ELF_DLNOTES_SRC [==[
 *  #ifndef __ELF__
 *    ELF DL notes is only supported on ELF platforms
 *  #endif
 *  __attribute__ ((used,aligned(4),section(".note.dlopen"))) static const struct {
 *    struct { int a; int b; int c; } hdr; char name[4]; __attribute__((aligned(4))) char json[24];
 *  } dlnote = { { 4, 0x407c0c0aU, 16 }, "FDO", "[\\"a\\":{\\"a\\":\\"1\\",\\"b\\":\\"2\\"}]" };
 *  int main(int argc, char *argv[]) {
 *    return argc + dlnote.hdr.a;
 *  }
 *  ]==])
 *  check_c_source_compiles("${CHECK_ELF_DLNOTES_SRC}" COMPILER_SUPPORTS_ELFNOTES)
 *  if(NOT COMPILER_SUPPORTS_ELFNOTES)
 *    set(SDL_DISABLE_DLOPEN_NOTES TRUE)
 *  endif()
 * ```
 */

#ifndef SDL_dlopennote_h
#define SDL_dlopennote_h

/**
 * Use this macro with SDL_ELF_NOTE_DLOPEN() to note that a dynamic shared library dependency is optional.
 *
 * Optional functionality uses the dependency, the binary will work and the dependency is only needed for full-featured installations.
 *
 * \since This macro is available since SDL 3.4.0.
 *
 * \sa SDL_ELF_NOTE_DLOPEN