# Host files File path: `out/dir/api.rs` ```rust // Host code /* Rust API */ #[derive(Debug)] pub enum Commands { NameOne(name_one::NameOne), } pub mod name_one { #[derive(Debug)] pub enum NameOne { #[allow(non_camel_case_types)] from_first_namespace, #[allow(non_camel_case_types)] from_second_namespace, } } /* C API */ pub mod name_one_c {} #[no_mangle] pub extern "C" fn name_one_from_first_namespace() -> core::ffi::c_int { callback_function(name_one_from_first_namespace); return 1; } #[no_mangle] pub extern "C" fn name_one_from_second_namespace() -> core::ffi::c_int { callback_function(name_one_from_second_namespace); return 1; } // vim: filetype=rust ``` # Auxiliary files File path: `dist/interface.h` ```c #if !defined TRIXY_MAIN_HEADER #define TRIXY_MAIN_HEADER #include "errno.h" #include "string.h" #include "vec.h" extern int name_one_from_first_namespace (); extern int name_one_from_second_namespace (); struct name_one { int (*from_first_namespace) (void); int (*from_second_namespace) (void); }; const struct name_one name_one = { .from_first_namespace = name_one_from_first_namespace, .from_second_namespace = name_one_from_second_namespace, }; #endif // if !defined TRIXY_MAIN_HEADER // vim: filetype=c ```