Module show_notes::e031
source · Expand description
FFI Deep Dive
- Date: May 11, 2019
- Subject: Exposing Rust types and functions to C API consumers.
- download mp3
- script
Modules
- Demonstrate unions! Combines an
enum
and aunion
into astruct
that acts mostly like a regular Rustenum
.
Structs
- A struct identical to
Point
, but which is not#[repr(C)]
! - A simple struct which we can expose to a C API. Note that it is
#[repr(C)]
! - e031: FFI Deep Dive!
Functions
- The simplest possible example of exposing Rust functions via a C FFI.
- Take two strings in and concatentate them without mutating either.
- Free any string allocated by Rust.
- Safety
- Safely drops the
OpaquePoint
instance. - Expose an interface for C API callers to call the
OpaquePoint
impl. - Expose an interface for C API callers to call the
Point
impl.