feat(ffi): install global panic handler (#108)

This commit is contained in:
Friedel Ziegelmayer
2019-05-30 15:18:34 +02:00
committed by Lars-Magnus Skog
parent 5c8bfd4370
commit a2fc127923
2 changed files with 6 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ crate-type = ["cdylib", "staticlib"]
[dependencies]
deltachat = { path = "../" }
libc = "0.2"
human-panic = "1.0.1"
[features]
default = ["deltachat/vendored"]
default = ["deltachat/vendored"]

View File

@@ -7,8 +7,8 @@
non_snake_case
)]
extern crate deltachat;
extern crate libc;
#[macro_use]
extern crate human_panic;
use deltachat::*;
@@ -28,6 +28,8 @@ pub unsafe extern "C" fn dc_context_new(
userdata: *mut libc::c_void,
os_name: *const libc::c_char,
) -> *mut dc_context_t {
setup_panic!();
let ctx = context::dc_context_new(cb, userdata, os_name);
Box::into_raw(Box::new(ctx))
}