- BufferLib is a small library for managing memory buffers
$ meson setup --wipe <builddir> # wipe the build artifacts (like object files)
$ meson setup <builddir> --reconfigure --buildtype=release # reconfigure the build directory for release build
$ meson compile -C <builddir> # compile the project
$ meson setup --wipe <buildir> # wipe the build artifacts (like object files)
$ meson setup <builddir> --reconfigure --buildtype=release # reconfigure the build directory for debug build
$ meson compile -C <builddir> # compile the project
$ meson setup --wipe <buildir> # wipe the build artifacts (like object files)
# NOTE: --buildtype=release or --buildtype=debug options can be added here
$ meson setup -C <builddir> --reconfigure --default-library=static # reconfigure the build directory for static library
$ meson compile -C <builddir> # compile the project
$ meson install -C <builddir> # install the static library
$ meson setup --wipe <buildir> # whipe the build artifacts (like object files)
# NOTE: --buildtype=release or --buildtype=debug options can be added here
$ meson setup -C <builddir> --reconfigure --default-library=shared # reconfigure the build directory for shared library
$ meson compile -C <builddir> # compile the project
$ meson install -C <builddir> # install the shared library
- Headers: /include/
- Static Libraries: /lib/lib.a-
- Shared Libraries: /bin/lib.dll
- PkgConfig (.pc) for static library: $PKG_CONFIG_PATH/_static.pc
- PkgConfig (.pc) for shared library: $PKG_CONFIG_PATH/_shared.pc
Types
- BUFFER --> The Buffer Object which contains all the information such as its size, strides, count, and capacity
- pBUFFER --> Just a typedef of BUFFER*
Two ways
- Bind -> Perform Operations -> UnBind
- Perform Operations passing the object (buffer)
Example:
#include <bufferlib/buffer.h>
#include <stdint.h>
int main(int argc, const char* argv[])
{
buffer_t values = buf_new(int32_t);
buf_push_auto(&values, 4);
buf_push_auto(&values, 100);
buf_push_auto(&values, 101);
buf_traverse_elements(&values, 0, buf_get_element_count(&values) - 1, buf_s32_print, NULL);
buf_free(&values);
return 0;
}