test
This commit is contained in:
parent
fc4b777577
commit
d95ca2ad8d
|
@ -0,0 +1,6 @@
|
||||||
|
[package]
|
||||||
|
name = "hello-rust"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,12 @@
|
||||||
|
extern crate core;
|
||||||
|
use core::ffi::c_int;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
fn multiply(a: c_int, b: c_int) -> c_int;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
unsafe {
|
||||||
|
println!("Result: {}", multiply(100, 5));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
int32_t multiply(int32_t a, int32_t b) {
|
||||||
|
printf("[C] Hello from C!\n");
|
||||||
|
printf("[C] Input a is: %i \n", a);
|
||||||
|
printf("[C] Input b is: %i \n", b);
|
||||||
|
printf("[C] Multiplying and returning result to Rust..\n");
|
||||||
|
|
||||||
|
return a * b;
|
||||||
|
}
|
Loading…
Reference in New Issue