Skip to content

libc eve extensions

Denis Yaroshevskiy edited this page Jun 5, 2021 · 2 revisions

We have a bit of a problem, using eve requires C++20 and march which is tricky for a lot of users.

A solution to this problem would be to use dynamic linking and a c library interface:

  • Take a library written with eve
  • Add a C interface on top of it (or some C++ but portable between different marches)
  • Build this library for all interesting platforms
  • Dynamically load the one appropriate for your current platform.

Unfortunately, this is obviously easier said than done.

So I suggest: we create an example project that contains a bunch of sample eve algorithms that we build for all supported platforms. We'd also compile it for asan, tsan enabled. We also implement the selection bit that decides which one should be loaded.

We can call it libc-eve-extensions or smth.

It will contain something a long the lines of:

uint32_t const* find_u32(uint32_t const* f, uint32_t const* l, uint32_t x);
uint64_t const* find_u64(uint64_t const* f, uint64_t const* l, uint64_t x);
...
uint32_t* remove(uint32_t* f, uint32_t* l, uint32_t x);
...
void sort_i32(int32_t* f, int32_t* l);
void sort_u32(uint32_t* f, uint32_t* l);
void sort_decending_i32(int32_t* f, int32_t* l);
void sort_decending_u32(uint32_t* f, uint32_t* l);

It achieves 2 things:

  • We show how we suggest to use the eve library for projects that are not 100% built from source (including package management and such).
  • This is a nice library all by itself.
Clone this wiki locally