Disk ARchive: get_version.hpp Source File

| Disk ARchive 2.8.1 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
get_version.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26
27
28#ifndef GET_VERSION_HPP
29#define GET_VERSION_HPP
30
31#include "../my_config.h"
32
33extern "C"
34{
35#if MUTEX_WORKS
36#if HAVE_PTHREAD_H
37#include <pthread.h>
38#endif
39#endif
40}
41
42#include <string>
43#include "integers.hpp"
44
46
47namespace libdar
48{
49
52
54 constexpr U_I LIBDAR_COMPILE_TIME_MAJOR = 7;
56 constexpr U_I LIBDAR_COMPILE_TIME_MEDIUM = 0;
58 constexpr U_I LIBDAR_COMPILE_TIME_MINOR = 0;
59
61 // LIBDAR INITIALIZATION METHODS //
62 // //
63 // A FUNCTION OF THE get_version*() FAMILY *MUST* BE CALLED //
64 // BEFORE ANY OTHER FUNCTION OF THIS LIBRARY //
65 // //
66 // CLIENT PROGRAM MUST CHECK THAT THE MAJOR NUMBER RETURNED //
67 // BY THIS CALL IS NOT GREATER THAN THE VERSION USED AT COMPILATION //
68 // TIME. IF SO, THE PROGRAM MUST ABORT AND RETURN A WARNING TO THE //
69 // USER TELLING THE DYNAMICALLY LINKED VERSION IS TOO RECENT AND NOT //
70 // COMPATIBLE WITH THIS SOFTWARE. THE MESSAGE MUST INVITE THE USER //
71 // TO UPGRADE HIS SOFTWARE WITH A MORE RECENT VERSION COMPATIBLE WITH //
72 // THIS LIBDAR RELEASE. //
74
76
85 extern void get_version(U_I & major, U_I & medium, U_I & minor, bool init_libgcrypt = true);
86
87
89
97 extern void get_version(U_I & major, U_I & medium, U_I & minor, bool init_libgcrypt, bool init_gpgme);
98
99
101
110 extern void get_version(U_I & major, U_I & medium, U_I & minor, U_I gcrypt_secured_memory, bool init_gpgme);
111
113 extern void get_version(bool init_libgcrypt = true);
114
116 // CLOSING/CLEANING LIBDAR //
118
119 // while libdar has only a single boolean as global variable
120 // that defines whether the library is initialized or not
121 // it must proceed to mutex, and dependent libraries initializations
122 // (liblzo, libgcrypt, etc.), which is done during the get_version() call
123 // Some library also need to clear some data so the following call
124 // is provided in that aim and must be called when libdar will no more
125 // be used by the application.
126
127 extern void close_and_clean();
128
130 // THREAD CANCELLATION ROUTINES //
132
133#if MUTEX_WORKS
135
141 extern void cancel_thread(pthread_t tid, bool immediate = true, U_64 flag = 0);
142
144
147 extern bool cancel_status(pthread_t tid);
148
150
154 extern bool cancel_clear(pthread_t tid);
155
157 extern U_I get_thread_count();
158#endif
159
160
162
163} // end of namespace
164
165extern "C"
166{
168
172 extern unsigned int for_autoconf(unsigned int x);
173}
174
175#endif
for_autoconf
unsigned int for_autoconf(unsigned int x)
in case you use autoconf AC_CHECK_LIB in your program to detect the availability of libdar
libdar::get_version
void get_version(U_I &major, U_I &medium, U_I &minor, bool init_libgcrypt=true)
return the libdar version, and make libdar initialization (may throw Exceptions)
libdar::LIBDAR_COMPILE_TIME_MEDIUM
constexpr U_I LIBDAR_COMPILE_TIME_MEDIUM
libdar Medium version defined at compilation time
Definition get_version.hpp:56
libdar::LIBDAR_COMPILE_TIME_MAJOR
constexpr U_I LIBDAR_COMPILE_TIME_MAJOR
libdar Major version defined at compilation time
Definition get_version.hpp:54
libdar::LIBDAR_COMPILE_TIME_MINOR
constexpr U_I LIBDAR_COMPILE_TIME_MINOR
libdar Minor version defined at compilation time
Definition get_version.hpp:58
integers.hpp
are defined here basic integer types that tend to be portable
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47