Add Sample Functions to Library

This commit is contained in:
GuilhermeWerner
2021-01-21 12:35:08 -03:00
parent 55ef94f93f
commit 89085ce699
2 changed files with 23 additions and 3 deletions

View File

@ -10,7 +10,7 @@ publish = false
[lib] [lib]
name="Library" name="Library"
crate-type = ["cdylib"] crate-type = ["staticlib", "cdylib", "rlib"]
path = "Source/Library.rs" path = "Source/Library.rs"
[dependencies] [dependencies]

View File

@ -1,3 +1,23 @@
pub fn Hello() { #![allow(dead_code)]
println!("Hello Library"); #![allow(unused_variables)]
#![allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn Add(num1: f32, num2: f32) -> f32 {
return num1 + num2;
}
#[no_mangle]
pub extern "C" fn Subtract(num1: f32, num2: f32) -> f32 {
return num1 - num2;
}
#[no_mangle]
pub extern "C" fn Multiply(num1: f32, num2: f32) -> f32 {
return num1 * num2;
}
#[no_mangle]
pub extern "C" fn Divide(num1: f32, num2: f32) -> f32 {
return num1 / num2;
} }