aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-10-22 09:02:41 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-11-03 15:09:19 +0100
commit3e5ef9e181084cc88ef59811e6eba1d7d82ba4cf (patch)
tree1b8e2fbf5965d8f2ee69b839282d2b9f7692e463 /NK_C_API.cc
parentdab6f2bcf292dfd6ee629a4ad9b2216e104d7c1d (diff)
downloadlibnitrokey-3e5ef9e181084cc88ef59811e6eba1d7d82ba4cf.tar.gz
libnitrokey-3e5ef9e181084cc88ef59811e6eba1d7d82ba4cf.tar.bz2
Use hand-inserted version. Remove one Git pass.pr_62
Full version name should consist of official version and Git one Git describe should never fail with --always switch Add more build specific information Save compilation definitions and flags Move getting information to the end of CMakeLists.txt Use configuration over definitions Proper implementation in C API for getting version Test case for getting version. Working configure file Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NK_C_API.cc')
-rw-r--r--NK_C_API.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index 6f4c757..704feec 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -4,6 +4,7 @@
#include <cstring>
#include "include/LibraryException.h"
#include "include/cxx_semantics.h"
+#include "version.h"
#ifdef _MSC_VER
#ifdef _WIN32
@@ -99,6 +100,7 @@ uint8_t get_without_result(T func){
}
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -533,7 +535,12 @@ extern "C" {
NK_C_API const char * NK_version() {
- return VERSION;
+ auto m = NitrokeyManager::instance();
+ return get_with_string_result([&](){
+ const std::string & s = Version::version;
+ char * rs = strndup(s.c_str(), max_string_field_length);
+ return rs;
+ });
}
#ifdef __cplusplus