This is an implementation of liburing that's header only and trying to be standard compliant (which liburing itself is not).
- Header Only
- No Undefined Behaviours
- Standard compliant (No compiler-specific features)
- -pedantic friendly
- C and C++ compatibility without any
extern "C"
orextern "C++"
es
This library is a fork of liburing 2.4 (or 2.5, here's the exact commit); we've kept up with the changes so far (version 2.7).
- The original liburing library, is not very C++ friendly
- Use this fork even if you prefer a non-header-only version for C++
- The primary aim of this fork is for C++ users (at least currently that is)
- This fork trys to stay compliant with the upstream's API
- All the functions are marked as
noexcept
for C++ - There a few compiler-specific features and UBs remaining that will be fixed
Using CPM.cmake (Use a release link instead of the master branch, and adjust the version):
CPMAddPackage(
NAME liburing
URL https://github.com/the-moisrex/liburing-hdr-only/archive/refs/heads/master.zip
VERSION 2.7
OPTIONS
"LIBURING_CXX ON"
)
#ifdef __linux__
# if defined(USE_OS_LIBURING) && __has_include(<liburing.h>)
# include <liburing.h>
# else
# include <liburing/liburing-hdr-only.h>
# endif
#endif
Then define USE_OS_LIBURING
in your build system (-DUSE_OS_LIBURING
) to enable the use of original liburing if it exists,
and fallback on the header-only version otherwise.
#ifdef __linux__
# if __has_include(<liburing/liburing-hdr-only.h>)
# include <liburing/liburing-hdr-only.h>
# else
# include <liburing.h>
# endif
#endif