2014-10-05 2:34 GMT+04:00 Niall Douglas <s_sourceforge@nedprod.com>:
On 4 Oct 2014 at 14:42, Mathias Gaunard wrote:
On 04/10/2014 13:24, Niall Douglas wrote:
Andrey, please list here three C++ compilers which had at least one version release in the past five years which doesn't provide a magic macro expanding out to the mangling of the enclosing function.
What about MinGW?
I just ran the following program on MinGW:
#include <iostream> #include <typeinfo>
template<class T> void doprint(T a) { std::cout << __func__ << std::endl; std::cout << __FUNCTION__ << std::endl; std::cout << __PRETTY_FUNCTION__ << std::endl; struct $$$ { }; std::cout << typeid($$$).name() << std::endl; } template<class T> struct doprint$$$___$$$ { };
int main(void) { doprint(1); std::cout << typeid(doprint$$$___$$$<int>).name() << std::endl; return 0; }
It prints:
doprint doprint void doprint(T) [with T = int] Z7doprintIiEvT_E3$$$ 16doprint$$$___$$$IiE
That's exactly what I'm talking about. typeid returns *types*, while Boost.DLL works with exported *instances*. In other words: #include <typeinfo> #include <iostream> #include <boost/variant.hpp> namespace foo { namespace adl_barrier { boost::variant<int, short> export_me_function(boost::variant<int, short>, boost::variant<int, short>) { return 0; } boost::variant<int, short> export_me_variable; } // namespace adl_barrier using adl_barrier::export_me_function; using adl_barrier::export_me_variable; } int main() { std:: cout << typeid(foo::export_me_function).name() << std::endl; std:: cout << typeid(foo::export_me_variable).name() << std::endl; } The program from above will output: FN5boost7variantIisNS_6detail7variant5void_ES3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_EES4_S4_E N5boost7variantIisNS_6detail7variant5void_ES3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_S3_EE However we need the following: _ZN3foo11adl_barrier18export_me_functionEN5boost7variantIisNS1_6detail7variant5void_ES5_S5_S5_S5_S5_S5_S5_S5_S5_S5_S5_S5_S5_S5_S5_S5_S5_EES6_ _ZN3foo11adl_barrier18export_me_variableE -- Best regards, Antony Polukhin