FFI bindings generated with bindgen.
The crate wraps the libgrokj2k C API and provides raw unsafe access to
all public functions and types.
- Rust toolchain (stable)
pkg-config- Grok installed (so that
pkg-config --libs libgrokj2kworks)
If Grok is installed to a non-standard prefix:
# Linux
export PKG_CONFIG_PATH=/path/to/grok/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/path/to/grok/lib:$LD_LIBRARY_PATH
# macOS
export PKG_CONFIG_PATH=/path/to/grok/lib/pkgconfig:$PKG_CONFIG_PATH
export DYLD_LIBRARY_PATH=/path/to/grok/lib:$DYLD_LIBRARY_PATHWindows: The build script currently requires pkg-config. On Windows you
can use pkg-config-lite
or vcpkg to provide it, with PKG_CONFIG_PATH pointing
to your Grok install.
cargo build
cargo test --lib --tests
cargo run --example initialize_grok
Add the crate as a dependency (local path or publish to a registry):
use grokj2k_sys::*;
use std::ffi::CStr;
fn main() {
unsafe {
grk_initialize(std::ptr::null(), 0, std::ptr::null_mut());
let version = CStr::from_ptr(grk_version());
println!("Grok version: {}", version.to_str().unwrap());
grk_deinitialize();
}
}