Skip to content

Instantly share code, notes, and snippets.

@lierdakil
Last active March 1, 2017 11:28
Show Gist options
  • Select an option

  • Save lierdakil/3e8931bad94d8173e6d62aa64f2226d2 to your computer and use it in GitHub Desktop.

Select an option

Save lierdakil/3e8931bad94d8173e6d62aa64f2226d2 to your computer and use it in GitHub Desktop.
#if !BOOST_PP_IS_ITERATING
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/facilities/expand.hpp>
#include <boost/preprocessor/stringize.hpp>
#define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PP_SEQ_SIZE(PLUGINS), "plugins_pp.h"))
#include BOOST_PP_ITERATE()
#else
#ifdef PLUGINS_INCLUDE
#include BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(BOOST_PP_EXPAND(BOOST_PP_DEC(BOOST_PP_ITERATION())), PLUGINS).h)
#else
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(BOOST_PP_EXPAND(BOOST_PP_DEC(BOOST_PP_ITERATION())), PLUGINS), _init)();
#endif
#endif
#define PLUGINS (test1)(test2)(test3)
#include <stdio.h>
#define PLUGINS_INCLUDE
#include "plugins_pp.h"
#undef PLUGINS_INCLUDE
int main() {
#include "plugins_pp.h"
}
void test1_init() {
printf("test1 init\n");
}
void test2_init() {
printf("test2 init\n");
}
void test3_init() {
printf("test3 init\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment