first commit

This commit is contained in:
aOK 2024-08-19 13:52:05 +03:00
commit e2c095af41
34 changed files with 667 additions and 0 deletions

8
examples/c.rs Normal file
View file

@ -0,0 +1,8 @@
// examples/c.rs
// sudo cargo run --example c --release
fn main() {
unsafe {
rust_interop::add_and_print(2, 4); // Call the function from rust_interop
}
}

25
examples/java.rs Normal file
View file

@ -0,0 +1,25 @@
use std::process::Command;
fn main() {
// Run the Java command after the build
if let Err(e) = run_java_command() {
panic!("Failed to run Java command: {:?}", e);
}
}
fn run_java_command() -> std::io::Result<()> {
let java_class_path = "./java";
let java_library_path = "./target/release";
let status = Command::new("java")
.arg("-cp")
.arg(java_class_path)
.arg(format!("-Djava.library.path={}", java_library_path))
.arg("HelloWorld")
.status()?;
if !status.success() {
panic!("Java execution failed");
}
Ok(())
}

9
examples/swift.rs Normal file
View file

@ -0,0 +1,9 @@
use rust_interop::swift::swiftFunction;
fn main() {
unsafe {
// let result = rust_interop::swift::swiftFunction();
let result = swiftFunction();
println!("Result from Swift function: {}", result);
}
}