2024-08-02 22:58:32 +02:00
|
|
|
/// libssv.rs
|
|
|
|
///
|
|
|
|
/// Low level bindings to the SSVLIB dynamic library.
|
|
|
|
// TODO : look for creating a dedicated *-sys crate : https://kornel.ski/rust-sys-crate
|
2024-08-02 00:08:49 +02:00
|
|
|
use libc::{c_char, c_ushort, c_void, size_t};
|
2024-08-15 19:27:57 +02:00
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
#[derive(Debug, Error)]
|
|
|
|
pub enum LibSSVError {
|
|
|
|
#[error("SSV library error in {function}: {code}")]
|
|
|
|
StandardErrorCode { code: u16, function: &'static str },
|
|
|
|
}
|
2024-07-27 16:04:05 +02:00
|
|
|
|
|
|
|
#[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;
|
2024-08-02 00:08:49 +02:00
|
|
|
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;
|
2024-07-27 16:04:05 +02:00
|
|
|
}
|
2024-08-02 22:58:32 +02:00
|
|
|
// TODO : replace void* by Rust struct : https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
|