summaryrefslogtreecommitdiff
path: root/rusty-haskell/rust
diff options
context:
space:
mode:
authorstuebinm2021-04-11 03:37:32 +0200
committerstuebinm2021-04-11 03:37:32 +0200
commitfa49e0bf71ccd4bc98df0fa83546250c1b849e2e (patch)
treef84c1ff8000fe87fae6b7c703e6b7871101a5094 /rusty-haskell/rust
parentf7605dfefa304b1a7b20a474ce168cd5b9849533 (diff)
simple ffi with rust and haskell
so far, only calling rust from haskell, not the other way round.
Diffstat (limited to '')
-rw-r--r--rusty-haskell/rust/.gitignore1
-rw-r--r--rusty-haskell/rust/Cargo.lock6
-rw-r--r--rusty-haskell/rust/Cargo.toml13
-rw-r--r--rusty-haskell/rust/src/lib.rs11
4 files changed, 31 insertions, 0 deletions
diff --git a/rusty-haskell/rust/.gitignore b/rusty-haskell/rust/.gitignore
new file mode 100644
index 0000000..e420ee4
--- /dev/null
+++ b/rusty-haskell/rust/.gitignore
@@ -0,0 +1 @@
+target/*
diff --git a/rusty-haskell/rust/Cargo.lock b/rusty-haskell/rust/Cargo.lock
new file mode 100644
index 0000000..3cae764
--- /dev/null
+++ b/rusty-haskell/rust/Cargo.lock
@@ -0,0 +1,6 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "rustlib"
+version = "0.1.0"
+
diff --git a/rusty-haskell/rust/Cargo.toml b/rusty-haskell/rust/Cargo.toml
new file mode 100644
index 0000000..0bef17d
--- /dev/null
+++ b/rusty-haskell/rust/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "rustlib"
+version = "0.1.0"
+authors = ["stuebinm <stuebinm@disroot.org>"]
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[lib]
+name = "rustlib"
+crate-type = ["staticlib"]
+
+[dependencies]
diff --git a/rusty-haskell/rust/src/lib.rs b/rusty-haskell/rust/src/lib.rs
new file mode 100644
index 0000000..d954f2b
--- /dev/null
+++ b/rusty-haskell/rust/src/lib.rs
@@ -0,0 +1,11 @@
+
+
+#[no_mangle]
+pub extern fn double_input(x: i32) -> i32 {
+ 2 * x
+}
+
+#[no_mangle]
+pub extern fn print_hello() {
+ println!("hello, world, from rust!");
+}