/// libssv.rs /// /// Low level bindings to the SSVLIB dynamic library. // TODO : look for creating a dedicated *-sys crate : https://kornel.ski/rust-sys-crate use libc::{c_char, c_ushort, c_void, size_t}; use thiserror::Error; #[derive(Debug, Error)] pub enum LibSSVError { #[error("SSV library error in {function}: {code}")] StandardErrorCode { code: u16, function: &'static str }, } #[cfg_attr(target_os = "linux", link(name = "ssvlux64"))] #[cfg_attr(target_os = "windows", link(name = "ssvw64"))] extern "C" { pub fn SSV_InitLIB2(pcRepSesamIni: *const c_char) -> c_ushort; pub fn SSV_LireCartePS( NomRessourcePS: *const c_char, NomRessourceLecteur: *const c_char, CodePorteurPS: *const c_char, ZDonneesSortie: *mut *mut c_void, TTailleDonneesSortie: *mut size_t, ) -> c_ushort; pub fn SSV_LireConfig( ZDonneesSortie: *mut *mut c_void, TTailleDonneesSortie: *mut size_t, ) -> c_ushort; } // TODO : replace void* by Rust struct : https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs