So I found a need in using something like Boost.Extension to keep my apps more open to new modules. But as soon as I got to first tutorial I found out that its syntax is quite not like I’m used to:
// Depending on the compiler and settings,
// it may be necessary to add a specific export
// declaration. The BOOST_EXTENSION_EXPORT_DECL
// adds this if necessary.
void BOOST_EXTENSION_EXPORT_DECL
boost_extension_hello_world(int repetitions) {
for (int i = 0; i < repetitions; ++i) {
std::cout << "Hello World" << std::endl;
}
}
I want to make it possible to write something like void function instead of void BOOST_EXTENSION_EXPORT_DECL it looks better and as i have AS3 background it will not look like something horrible for me.
So how to create an overrite for C++ macro not in header where it was defined but in your own C++ file?
You can replace
BOOST_EXTENSION_EXPORT_DECLbyfunctionwith:Then you can use it by:
But this could cause problems if your code contains the word
function, because the compiler replace all occurrence offunction.