Added more run-time version checks

This commit is contained in:
Paul Sutton 2015-11-16 12:24:42 +00:00
parent 591f583edb
commit 61d1cf3201
2 changed files with 11 additions and 1 deletions

View File

@ -32,7 +32,7 @@
#define SRSLTE_VERSION_MAJOR @SRSLTE_VERSION_MAJOR@
#define SRSLTE_VERSION_MINOR @SRSLTE_VERSION_MINOR@
#define SRSLTE_VERSION_PATCH @SRSLTE_VERSION_PATCH@
#define SRSLTE_VERSION_STRING @SRSLTE_VERSION_STRING@
#define SRSLTE_VERSION_STRING "@SRSLTE_VERSION_STRING@"
#define SRSLTE_VERSION_ENCODE(major, minor, patch) ( \
((major) * 10000) \
@ -49,8 +49,10 @@
#include "srslte/config.h"
SRSLTE_API char* srslte_get_version();
SRSLTE_API int srslte_get_version_major();
SRSLTE_API int srslte_get_version_minor();
SRSLTE_API int srslte_get_version_patch();
SRSLTE_API int srslte_check_version(int major, int minor, int patch);
#endif // VERSION_

View File

@ -26,6 +26,10 @@
#include "srslte/version.h"
char* srslte_get_version() {
return SRSLTE_VERSION_STRING;
}
int srslte_get_version_major() {
return SRSLTE_VERSION_MAJOR;
}
@ -35,3 +39,7 @@ int srslte_get_version_minor() {
int srslte_get_version_patch() {
return SRSLTE_VERSION_PATCH;
}
int srslte_check_version(int major, int minor, int patch) {
return (SRSLTE_VERSION >= SRSLTE_VERSION_ENCODE(major,minor,patch));
}