Skip to main content
libmem can be installed through various package managers or used directly with CMake without installation.

Package Managers

vcpkg install libmem
For Rust and Python, libmem will automatically download and link the library if no installation is found. Manual installation is optional.

vcpkg

vcpkg vcpkg is a cross-platform package manager from Microsoft that supports C/C++ libraries.
1

Install vcpkg

Follow the instructions at https://github.com/microsoft/vcpkg
2

Install libmem

vcpkg install libmem
For detailed commands on installing different versions and more information, refer to Microsoft’s official instructions.

Python

Requires Python >= 3.6

Install from PyPI

The easiest way to install libmem for Python:
pip install --upgrade libmem

Build from Source

If you want to build the Python bindings yourself:
cd libmem-py
python configure.py
python setup.py install
Note: If no libmem installation is found, the Python package will automatically fetch and link the library. You can use the LIBDIR=<path> environment variable to specify a custom libmem installation path.

Rust

Add libmem to your Cargo.toml:
[dependencies]
libmem = "5"
Then import it in your Rust code:
use libmem::*;
Note: The fetch feature is enabled by default, which automatically downloads libmem if not found. If you disable this feature, you can specify a custom path using the LIBMEM_DIR=<path> environment variable.

CMake (without installing)

You can use libmem in your CMake project without installing it system-wide by using FetchContent:
include(FetchContent)

# Download and set up libmem
FetchContent_Declare(libmem-config URL "https://raw.githubusercontent.com/rdbo/libmem/config-v1/libmem-config.cmake" DOWNLOAD_NO_EXTRACT TRUE)
FetchContent_MakeAvailable(libmem-config)
set(CMAKE_PREFIX_PATH "${libmem-config_SOURCE_DIR}" "${CMAKE_PREFIX_PATH}")
set(LIBMEM_DOWNLOAD_VERSION "5.1.4")

# Find libmem package
find_package(libmem CONFIG REQUIRED)
Link against libmem:
# Link against libmem
target_link_libraries(<YOUR_TARGET_NAME> PRIVATE libmem::libmem)
It might be necessary to link against other dependencies. See the Dependencies section for more information.

Pre-built Binaries

You can download pre-built binaries from the GitHub Releases page.
Windows Users: If you download a binary version, you only need to install the Windows SDK. Add libmem/include to your project’s include directories and link against the downloaded binary.

Dependencies

libmem has several dependencies that are bundled with the project: All Platforms:
  • capstone (included)
  • keystone (included)
  • LIEF (included)
  • libstdc++ (used in keystone, LIEF and LLVM)
  • libmath (used in keystone)
Windows:
  • Windows SDK (user32.lib, psapi.lib, ntdll.lib, shell32.lib)
Linux/Android:
  • libdl (-ldl)
FreeBSD:
  • libdl (-ldl)
  • libkvm (-lkvm)
  • libprocstat (-lprocstat)
  • libelf (-lelf)

Next Steps

After installing libmem, head to the Quickstart guide to write your first program with libmem.

Build docs developers (and LLMs) love