From c7c746a383c65e3e968168030a08ae1ffd273624 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sat, 27 Feb 2021 22:59:06 -0800 Subject: [PATCH] Move radio_list() to Rust --- main.c | 1 + radio.c | 2 +- radio.h | 2 +- src/lib.rs | 11 +++++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 088050a..641528f 100644 --- a/main.c +++ b/main.c @@ -38,6 +38,7 @@ extern int optind; extern void print_message_from_rust(); extern void print_usage(const char* version); +extern void radio_list(); int trace_flag = 0; diff --git a/radio.c b/radio.c index 55664ec..c5634d4 100644 --- a/radio.c +++ b/radio.c @@ -127,7 +127,7 @@ void radio_connect() // // List all supported radios. // -void radio_list() +void radio_list_c() { int i; diff --git a/radio.h b/radio.h index d35960f..48334e6 100644 --- a/radio.h +++ b/radio.h @@ -85,7 +85,7 @@ void radio_write_csv(const char *filename); // // List all supported radios. // -void radio_list(void); +void radio_list_c(void); // // Check for compatible radio model. diff --git a/src/lib.rs b/src/lib.rs index 8bdacad..8528d77 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -54,6 +54,17 @@ pub extern "C" fn process_options() { } +extern { + fn radio_list_c(); +} + +#[no_mangle] +pub extern "C" fn radio_list() { + unsafe { + radio_list_c(); + } +} + #[cfg(test)] mod tests { #[test]