XkbLibraryVersion(3)

✨ XkbLibraryVersion(3) ✨

okay so this is a page from the XKB FUNCTIONS section of the manual (yes, the X11 one, we love a legacy icon πŸ’…), and it's literally all about XkbLibraryVersion β€” the little function that tells you whether the Xkb library you're actually running against is compatible with the one you built against. vibe check for your libraries, basically 🫢


πŸ’– NAME πŸ’–

XkbLibraryVersion β€” determines the compatibility of a library at runtime. yes bestie, at runtime, that's the whole point πŸ”₯


🌸 SYNOPSIS 🌸

Bool XkbLibraryVersion (int *lib_major_in_out, int *lib_minor_in_out);

πŸŽ€ ARGUMENTS πŸŽ€

  • lib_major_in_out β€” specifies and returns the major Xkb library version. it goes in, it comes back out β€” it's giving double duty, honestly iconic ✨
  • lib_minor_in_out β€” specifies and returns the minor Xkb library version. same deal, in-and-out energy πŸ’«

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the situation. if your application is dynamically linked, then both the X server and the client-side X library have to contain the Xkb extension for the client to be able to use the Xkb extension capabilities. both. no exceptions. so a dynamically linked application has to check both the library and the server for compatibility before it goes around calling any Xkb functions. a properly written program must check for compatibility between the version of the Xkb library that's dynamically loaded and the one that was used when the application was built. and then β€” after that β€” it must check the server version for compatibility with the version of Xkb in the library. two checks, in that order, that's the assignment 🎯

if your application is statically linked, you still have to check for server compatibility, and you may check library compatibility too. (it's actually possible to compile against one set of header files and link against a different, incompatible, version of the library β€” although this should not normally occur. like, it shouldn't happen, but the universe is chaotic 😭)

⚠️ so anyway β€” pass the symbolic value XkbMajorVersion in lib_major_in_out and XkbMinorVersion in lib_minor_in_out. these arguments represent the version of the library used at compile time. then XkbLibraryVersion backfills the major and minor version numbers of the library used at run time into lib_major_in_out and lib_minor_in_out. cute, right? πŸ’…

if the versions of the compile time and run time libraries are compatible, XkbLibraryVersion returns True. otherwise, it returns False. simple as that, no cap πŸ‘‘

and ALSO, bestie, listen β€” in order to use the Xkb extension, you have to make sure the extension is present in the server and that the server supports the version of the extension expected by the client. use XkbQueryExtension to do that, as described in the next section. don't skip this step, it's literally the main character of the next page 🌈


⭐ RETURN VALUES ⭐

  • True β€” XkbLibraryVersion returns True if the versions of the compile time and run time libraries are compatible. slay βœ…
  • False β€” XkbLibraryVersion returns False if the versions of the compile time and run time libraries are not compatible. not slay πŸ’€

🌟 SEE ALSO 🌟

go read those next, i'm obsessed with the whole set honestly 🧚


mwah πŸ’– that's the whole page! this little legend came from X Version 11, shipping with libX11 1.8.14 β€” go check compatibility at runtime and stay hydrated, bestie πŸ“πŸ¦‹

πŸ“¦ where this page comes from