1

最近、boost::function_types ライブラリを試していたところ、ちょっとした障害に遭遇しました。特定の関数の呼び出し規約を知りたいのですが、これを行う方法がよくわかりません。これが私がこれまでに持っているものです:

これにより、各 if ステートメント内で *_cc タグの値が見つからないというエラーが発生します。マクロを定義している方法に関係があるのではないかと思います。ドキュメントは、コンパイラで追加の呼び出し規約を設定する方法についてあまり明確ではありません...ここで何か助けていただければ幸いです。

ありがとう、

編集: 動作しました。以下のように config/config.hpp を含める必要があるようです:

#define BOOST_FT_COMMON_X86_CCs 1
#include <boost/function_types/config/config.hpp>
#include <boost/type_traits.hpp>
#include <boost/function_types/property_tags.hpp>
#include <boost/function_types/is_function.hpp>
#include <boost/function_types/is_function_pointer.hpp>
#include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/result_type.hpp>
#include <boost/function_types/function_arity.hpp>

template<class F>
inline void parse_cc(F f, func_info_s& out) {
    out.cc = cc_err;
    if (boost::function_types::is_function<F, stdcall_cc>::value == true) {
        out.cc = cc_stdcall;
    } else if (boost::function_types::is_function<F, fastcall_cc>::value == true) {
        out.cc = cc_fastcall;
    } else if (boost::function_types::is_function<F, cdecl_cc>::value == true) {
        out.cc = cc_cdecl;
    }
}
4

1 に答える 1

0

ヘッダー ファイル (config/config.hpp) の 1 つが欠けていたようです。

#define BOOST_FT_COMMON_X86_CCs 1
#include <boost/function_types/config/config.hpp>
#include <boost/type_traits.hpp>
#include <boost/function_types/property_tags.hpp>
#include <boost/function_types/is_function.hpp>
#include <boost/function_types/is_function_pointer.hpp>
#include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/result_type.hpp>
#include <boost/function_types/function_arity.hpp>

template<class F>
inline void parse_cc(F f, func_info_s& out) {
    out.cc = cc_err;
    if (boost::function_types::is_function<F, stdcall_cc>::value == true) {
        out.cc = cc_stdcall;
    } else if (boost::function_types::is_function<F, fastcall_cc>::value == true) {
        out.cc = cc_fastcall;
    } else if (boost::function_types::is_function<F, cdecl_cc>::value == true) {
        out.cc = cc_cdecl;
    }
}
于 2009-09-06T06:46:37.553 に答える