summaryrefslogtreecommitdiff
path: root/rust/src/ffi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/ffi.rs')
-rw-r--r--rust/src/ffi.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/src/ffi.rs b/rust/src/ffi.rs
new file mode 100644
index 00000000..54279233
--- /dev/null
+++ b/rust/src/ffi.rs
@@ -0,0 +1,13 @@
+
+macro_rules! ffi_wrap {
+ ($n:expr, $b:expr) => {{
+ use std::panic;
+ use std::process;
+
+ panic::catch_unwind(|| $b).unwrap_or_else(|_| {
+ error!("ffi callback caught panic: {}", $n);
+ process::abort()
+ })
+ }}
+}
+