📦 RSFindLibs: Rust Dynamic Library Finder & Wrapper Generator
A handy Rust library for:
- 🔍 Finding dynamic libraries at runtime.
- 🛠️ Generates the boilerplate needed by libloading
🔍 Library Finder
The find function helps you locate a dynamic library (.so, .dylib, .dll) at runtime by searching in:
- 🏗️ System paths
- ⚙️ Environment-specific paths (e.g.,
$CONDA_PREFIX,LD_LIBRARY_PATH) - 🔧 Custom-configured directories
Example
let libpath = find.expect;
println!;
🛠️ Macro for Generating Wrappers
The generate_library_wrapper! macro simplifies working with dynamic libraries by generating structs to load and call their functions seamlessly.
How It Works
- Declare the library functions you want to use.
- The macro generates a wrapper struct that loads the library and makes functions accessible like native Rust functions.
Example
use generate_library_wrapper;
use Library;
generate_library_wrapper!
pub static FDBLIB: = new;
🚀 Installation
Add the following to your Cargo.toml:
[]
= "0.1"
📄 License
Apache 2.0