1
0

refactor: rename project name from underline to dash

This commit is contained in:
2026-04-17 14:52:13 +08:00
parent 1509723ada
commit d2bd4425df
15 changed files with 5 additions and 5 deletions

58
wfassoc-cdylib/src/lib.rs Normal file
View File

@@ -0,0 +1,58 @@
use std::cell::RefCell;
use std::ffi::{CString, c_char};
use thiserror::Error as TeError;
mod last_error;
mod string_cache;
mod wrapper;
// region: Error
/// Error occurs in this crate.
#[derive(Debug, TeError)]
enum Error {
/// Error occurs in wfassoc core.
#[error("{0}")]
Core(#[from] wfassoc::Error),
#[error("error occurs when parsing into C/C++ string")]
CastIntoCStr(#[from] std::ffi::NulError),
#[error("error occurs when parsing from C/C++ string")]
CastFromCStr(#[from] std::ffi::IntoStringError),
}
/// Result type used in this crate.
type Result<T> = std::result::Result<T, Error>;
// endregion
// region: Macros
// endregion
#[unsafe(no_mangle)]
pub extern "C" fn WFStartup() -> bool {
false
}
#[unsafe(no_mangle)]
pub extern "C" fn WFShutdown() -> bool {
false
}
#[unsafe(no_mangle)]
pub extern "C" fn WFGetLastError() -> *const c_char {
last_error::get_last_error()
}
#[unsafe(no_mangle)]
pub extern "C" fn WFHasPrivilege() -> bool {
wfassoc::utilities::has_privilege()
}
#[unsafe(no_mangle)]
pub extern "C" fn WFAdd(left: u32, right: u32, rv: *mut u32) -> bool {
unsafe { *rv = left + right; }
return true;
}