SDL_ELF_NOTE_DLOPEN(3)

πŸ“¦
version 3.4.18 Β· 5 versions
, in fedora 43, fedora 44

πŸ’– SDL_ELF_NOTE_DLOPEN πŸ’–

okay so bestie, this one lives in the SDL3 FUNCTIONS crew, and it's about telling the world (well, telling ld.so and friends) that your app dynamically loads shared libraries. it's giving "hey, here's my shopping list of .so files" and honestly? iconic. πŸ›οΈβœ¨


🌸 NAME 🌸

SDL_ELF_NOTE_DLOPEN β€” adds a note that your application has dynamic shared library dependencies. that's it, that's the whole job. no cap. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_dlopennote.h>

#define SDL_ELF_NOTE_DLOPEN(feature, description, priority, ...) \
    SDL_ELF_NOTE_INTERNAL(                                       \
        "[{\"feature\":\"" feature                               \
        "\",\"description\":\"" description                      \
        "\",\"priority\":\"" priority                            \
        "\",\"soname\":" SDL_DLNOTE_JSON_ARRAY(__VA_ARGS__) "}]",   \
        SDL_DLNOTE_UNIQUE_NAME);

✨ DESCRIPTION ✨

so the way you do this is you drop it in the global scope, like so:

SDL_ELF_NOTE_DLOPEN(
    "png",
    "Support for loading PNG images using libpng (required for APNG)",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
    "libpng12.so.0"
)
🫢 heads up bestie: a trailing semicolon is not needed. the macro said "no thanks, I'm full."

and if you're that girl who supports multiple versions of a library? you can literally just list them all out, no gatekeeping:

// Our app supports SDL1, SDL2, and SDL3 by dynamically loading them
SDL_ELF_NOTE_DLOPEN(
    "SDL",
    "Create windows through SDL video backend",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED
    "libSDL-1.2.so.0", "libSDL2-2.0.so.0", "libSDL3.so.0"
)

πŸ’€ real talk though: this macro is not available for compilers that don't support variadic macros. if your compiler can't do ..., this whole vibe is a no-go. sorry babe.

🌈 AVAILABILITY 🌈

this macro is available since SDL 3.4.0. she's new-ish, she's fresh, she's serving. πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹

go read those next, they're the priority girlies and they matter. iykyk. πŸ’œ


okay that's the whole page!! mwah πŸ’‹ this came to you from Simple Directmedia Layer, version SDL 3.4.18, and this manual page is SDL_ELF_NOTE_DLOPEN(3). stay loaded, bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from