From 7df4de2ce74e6917431397a80435e71331336ee7 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 27 Apr 2015 14:25:53 +0200 Subject: Use the shared_library crate instead of loading symbols manually --- src/api/caca/ffi.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/api/caca/ffi.rs (limited to 'src/api/caca/ffi.rs') diff --git a/src/api/caca/ffi.rs b/src/api/caca/ffi.rs new file mode 100644 index 0000000..e0921ae --- /dev/null +++ b/src/api/caca/ffi.rs @@ -0,0 +1,23 @@ +use libc; +use std::ffi::CStr; +use std::mem; + +pub type caca_display_t = libc::c_void; +pub type caca_canvas_t = libc::c_void; +pub type caca_dither_t = libc::c_void; + +shared_library!(LibCaca, "libcaca.so.0", + pub fn caca_create_display(cv: *mut caca_canvas_t) -> *mut caca_display_t, + pub fn caca_free_display(dp: *mut caca_display_t) -> libc::c_int, + pub fn caca_get_canvas(dp: *mut caca_display_t) -> *mut caca_canvas_t, + pub fn caca_refresh_display(dp: *mut caca_display_t) -> libc::c_int, + pub fn caca_dither_bitmap(cv: *mut caca_canvas_t, x: libc::c_int, y: libc::c_int, + w: libc::c_int, h: libc::c_int, d: *const caca_dither_t, + pixels: *const libc::c_void) -> libc::c_int, + pub fn caca_free_dither(d: *mut caca_dither_t) -> libc::c_int, + pub fn caca_create_dither(bpp: libc::c_int, w: libc::c_int, h: libc::c_int, + pitch: libc::c_int, rmask: libc::uint32_t, gmask: libc::uint32_t, + bmask: libc::uint32_t, amask: libc::uint32_t) -> *mut caca_dither_t, + pub fn caca_get_canvas_width(cv: *mut caca_canvas_t) -> libc::c_int, + pub fn caca_get_canvas_height(cv: *mut caca_canvas_t) -> libc::c_int, +); -- cgit v1.2.3