Using BOOST, I am trying to get the calling convention of a function, and to do this I am taking a similar approach as the individual who posted the same question – however their solution has not solved my problem.
Heres a link to their problem: function calling convention with boost::function_types
I have attempted to get the calling convention using a similar approach but am getting compiler errors complaining that “cdecl_cc” is not defined. Heres a small snippet of my code:
#define BOOST_FT_COMMON_X86_CCs 1
#include <boost/function_types/config/config.hpp>
#include <boost/function_types/is_function.hpp>
static bool isCdecl()
{
if(boost::function_types::is_function<T, cdecl_cc>::value == true)
return true;
return false;
}
The other user claims that by adding an include to boost/function_types/config/config.hpp and by defining BOOST_FT_COMMON_X86_CCs, there problem was solved – however It has not solved mine.
I’ve tried placing the includes and the definition inside of a precompiled header as well.
Looking at config.hpp I see an include to cc_names.hpp which lists the definition like so
#define BOOST_FT_BUILTIN_CC_NAMES \
(( IMPLICIT , implicit_cc , BOOST_PP_EMPTY ))\
(( CDECL , cdecl_cc , BOOST_PP_IDENTITY(__cdecl ) ))\
(( STDCALL , stdcall_cc , BOOST_PP_IDENTITY(__stdcall ) ))\
(( PASCAL , pascal_cc , BOOST_PP_IDENTITY(pascal ) ))\
(( FASTCALL , fastcall_cc , BOOST_PP_IDENTITY(__fastcall) ))\
(( CLRCALL , clrcall_cc , BOOST_PP_IDENTITY(__clrcall ) ))\
(( THISCALL , thiscall_cc , BOOST_PP_IDENTITY(__thiscall) ))\
(( IMPLICIT_THISCALL , thiscall_cc , BOOST_PP_EMPTY ))
I am not sure how one should interpret a definition like this, if someone could explain it to me I might be able to figure out how to solve my problem.
Sorry for all the BOOST related questions from me, I am fairly new to it and I am diving head first into one of the more difficult libraries.
Thanks.
I believe you need to qualify
cdecl_ccwith theboost::function_types namespace, and also#include <boost/function_types/property_tags.hpp>.Boost is great, but the documentation can at times be obscure. I think they tend to write it as if it was part of the standard, so the namespace is implicit. But unless otherwise specified you should assume everything is in some namespace, either
boostor a more specific one.