From 918e4ff20c4e843b5b32d27274fbe558ec1b0000 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Mon, 29 Apr 2019 20:22:39 -0500 Subject: C: Add uhd_get_abi_string, uhd_get_version_string Clients that include the UHD C headers have access to the version and ABI #defines, but this is not available to clients that dynamically load the library. This commit adds publicly exported functions to provide this information. --- host/lib/version_c.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 host/lib/version_c.cpp (limited to 'host/lib/version_c.cpp') diff --git a/host/lib/version_c.cpp b/host/lib/version_c.cpp new file mode 100644 index 000000000..2897a6407 --- /dev/null +++ b/host/lib/version_c.cpp @@ -0,0 +1,34 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include +#include + +#include + +uhd_error uhd_get_abi_string( + char* abi_string_out, + size_t buffer_len +){ + UHD_SAFE_C( + const std::string cpp_abi_string = uhd::get_abi_string(); + + memset(abi_string_out, 0, buffer_len); + strncpy(abi_string_out, cpp_abi_string.c_str(), buffer_len); + ) +} + +uhd_error uhd_get_version_string( + char* version_out, + size_t buffer_len +){ + UHD_SAFE_C( + const std::string cpp_version = uhd::get_version_string(); + + memset(version_out, 0, buffer_len); + strncpy(version_out, cpp_version.c_str(), buffer_len); + ) +} -- cgit v1.2.3