diff options
Diffstat (limited to 'host/lib')
| -rw-r--r-- | host/lib/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | host/lib/version_c.cpp | 34 | 
2 files changed, 35 insertions, 0 deletions
| diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index b171cbfef..7e28399b4 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -131,6 +131,7 @@ LIBUHD_APPEND_SOURCES(  if(ENABLE_C_API)      LIBUHD_APPEND_SOURCES(          ${CMAKE_CURRENT_SOURCE_DIR}/error_c.cpp +        ${CMAKE_CURRENT_SOURCE_DIR}/version_c.cpp      )  endif(ENABLE_C_API) 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 <uhd/version.h> +#include <uhd/version.hpp> + +#include <string.h> + +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); +    ) +} | 
