Initial commit

This commit is contained in:
2025-02-06 14:33:22 +01:00
commit c31a19f09a
10 changed files with 443 additions and 0 deletions

9
main/Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "main"
version = "0.1.0"
edition = "2024"
[dependencies]
libloading = "0.8"
shared = { path = "../shared" }
stabby = { workspace = true }

19
main/src/main.rs Normal file
View File

@@ -0,0 +1,19 @@
use libloading::{Library, Symbol};
use shared::{Input, Output};
type ProcessFn = unsafe extern "C" fn(input: Input) -> Output;
fn main() {
unsafe {
let lib = Library::new("target/debug/libplugin.so").expect("Failed to load plugin");
let process: Symbol<ProcessFn> = lib.get(b"process").expect("Failed to load symbol");
let input = Input { a: 3, b: 4 };
let output: Output = process(input);
println!("Sum: {}", output.sum);
println!("Product: {}", output.product);
}
}