Loading...
Searching...
No Matches
get_version.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2026 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef GET_VERSION_HPP
#define GET_VERSION_HPP
#include "../my_config.h"
extern "C"
{
#if MUTEX_WORKS
#if HAVE_PTHREAD_H
#include <pthread.h>
#endif
#endif
}
#include <string>
#include "integers.hpp"
namespace libdar
{
constexpr U_I LIBDAR_COMPILE_TIME_MAJOR = 7;
constexpr U_I LIBDAR_COMPILE_TIME_MEDIUM = 0;
constexpr U_I LIBDAR_COMPILE_TIME_MINOR = 4;
// LIBDAR INITIALIZATION METHODS //
// //
// A FUNCTION OF THE get_version*() FAMILY *MUST* BE CALLED //
// BEFORE ANY OTHER FUNCTION OF THIS LIBRARY //
// //
// CLIENT PROGRAM MUST CHECK THAT THE MAJOR NUMBER RETURNED //
// BY THIS CALL IS NOT GREATER THAN THE VERSION USED AT COMPILATION //
// TIME. IF SO, THE PROGRAM MUST ABORT AND RETURN A WARNING TO THE //
// USER TELLING THE DYNAMICALLY LINKED VERSION IS TOO RECENT AND NOT //
// COMPATIBLE WITH THIS SOFTWARE. THE MESSAGE MUST INVITE THE USER //
// TO UPGRADE HIS SOFTWARE WITH A MORE RECENT VERSION COMPATIBLE WITH //
// THIS LIBDAR RELEASE. //
extern void get_version(U_I & major, U_I & medium, U_I & minor, bool init_libgcrypt = true);
extern void get_version(U_I & major, U_I & medium, U_I & minor, bool init_libgcrypt, bool init_gpgme);
extern void get_version(U_I & major, U_I & medium, U_I & minor, U_I gcrypt_secured_memory, bool init_gpgme);
extern void get_version(bool init_libgcrypt = true);
// CLOSING/CLEANING LIBDAR //
// while libdar has only a single boolean as global variable
// that defines whether the library is initialized or not
// it must proceed to mutex, and dependent libraries initializations
// (liblzo, libgcrypt, etc.), which is done during the get_version() call
// Some library also need to clear some data so the following call
// is provided in that aim and must be called when libdar will no more
// be used by the application.
extern void close_and_clean();
// THREAD CANCELLATION ROUTINES //
#if MUTEX_WORKS
extern void cancel_thread(pthread_t tid, bool immediate = true, U_64 flag = 0);
extern bool cancel_status(pthread_t tid);
extern bool cancel_clear(pthread_t tid);
extern U_I get_thread_count();
#endif
} // end of namespace
extern "C"
{
extern unsigned int for_autoconf(unsigned int x);
}
#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