Last active
January 26, 2020 14:48
-
-
Save jfalcou/509783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "library_mismatch.hpp" | |
BOOST_USE_LIBRARY_VERSION(foo,FEATURES2) | |
int foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MISMATCH_HPP | |
#define MISMATCH_HPP | |
#include "register.hpp" | |
#define FEATURES0 with | |
#if defined(FEATURES_A) | |
#define FEATURES1 BOOST_PP_CAT(FEATURES0,_A) | |
#else | |
#define FEATURES1 FEATURES0 | |
#endif | |
#if defined(FEATURES_B) | |
#define FEATURES2 BOOST_PP_CAT(FEATURES1,_B) | |
#else | |
#define FEATURES2 FEATURES1 | |
#endif | |
BOOST_REGISTER_LIBRARY_VERSION(foo,FEATURES2) | |
int foo(); | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "library_mismatch.hpp" | |
#include <cstdio> | |
int main() | |
{ | |
printf("%s\n",BOOST_PP_STRINGIZE(FEATURES2)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef BOOST_REGISTER_LIBRARY_HPP | |
#define BOOST_REGISTER_LIBRARY_HPP | |
#include <boost/system/config.hpp> | |
#include <boost/preprocessor/cat.hpp> | |
#include <boost/preprocessor/stringize.hpp> | |
#define BOOST_VERSION_MESSAGE _library_version_mismatch_ | |
#define BOOST_USE_LIBRARY_VERSION(S,V) \ | |
namespace boost { namespace config \ | |
{ \ | |
bool BOOST_SYSTEM_DECL \ | |
BOOST_PP_CAT(S,BOOST_PP_CAT(BOOST_VERSION_MESSAGE,V))() \ | |
{ \ | |
return true; \ | |
} \ | |
} } \ | |
/**/ | |
#define BOOST_REGISTER_LIBRARY_VERSION(S,V) \ | |
namespace boost { namespace config \ | |
{ \ | |
bool BOOST_SYSTEM_DECL \ | |
BOOST_PP_CAT(S,BOOST_PP_CAT(BOOST_VERSION_MESSAGE,V))(); \ | |
bool const BOOST_PP_CAT(check_,BOOST_PP_CAT(S,V)) = \ | |
BOOST_PP_CAT(S,BOOST_PP_CAT(BOOST_VERSION_MESSAGE,V))(); \ | |
} } \ | |
/**/ | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment