简体   繁体   English

无法在Boost.Python中使用__stdcall编译示例

[英]Can't compile example with __stdcall in Boost.Python

I'm trying to wrap a function in Python using Boost.Python and I'm facing problems when I use __stdcall . 我正在尝试使用Boost.Python在Python中包装一个函数,当我使用__stdcall时我遇到了问题。 Here's an example: 这是一个例子:

#define BOOST_PYTHON_STATIC_LIB
#define BOOST_PYTHON_ENABLE_STDCALL
#include <boost/python.hpp>
#include <boost/python/signature.hpp>

void __stdcall f(void) 
{
    return;
}

using namespace boost::python;

BOOST_PYTHON_MODULE(MyPyDLL)
{
    def("func", f);
}

When I try to compile I get more than 100 similar errors, but the first 2 are: 当我尝试编译时,我得到了100多个类似的错误,但前两个是:

error C2780: 'boost::mpl::vector10::type&,T0,T1,T2,T3,T4,T5,T6,T7> boost::python::detail::get_signature(RT (__thiscall ClassT::* )(T0,T1,T2,T3,T4,T5,T6,T7) const,Target *)': expects 2 arguments - 1 provided C:\\boost\\boost_1_62_0_python\\boost\\python\\make_function.hpp 104 错误C2780:'boost :: mpl :: vector10 :: type&,T0,T1,T2,T3,T4,T5,T6,T7> boost :: python :: detail :: get_signature(RT(__ thishisall ClassT :: *) (T0,T1,T2,T3,T4,T5,T6,T7)const,Target *)':需要2个参数 - 1提供C:\\ boost \\ boost_1_62_0_python \\ boost \\ python \\ make_function.hpp 104

error C2780: 'boost::mpl::vector10::type&,T0,T1,T2,T3,T4,T5,T6,T7> boost::python::detail::get_signature(RT (__thiscall ClassT::* )(T0,T1,T2,T3,T4,T5,T6,T7) volatile const,Target *)': expects 2 arguments - 1 provided C:\\boost\\boost_1_62_0_python\\boost\\python\\make_function.hpp 104 错误C2780:'boost :: mpl :: vector10 :: type&,T0,T1,T2,T3,T4,T5,T6,T7> boost :: python :: detail :: get_signature(RT(__ thishisall ClassT :: *) (T0,T1,T2,T3,T4,T5,T6,T7)volatile const,Target *)':需要2个参数 - 1提供C:\\ boost \\ boost_1_62_0_python \\ boost \\ python \\ make_function.hpp 104

As you can see, I used the define BOOST_PYTHON_ENABLE_STDCALL , which is mentioned in this page: 如您所见,我使用了BOOST_PYTHON_ENABLE_STDCALL中提到的定义BOOST_PYTHON_ENABLE_STDCALL

but the problem stays the same with or without defining it. 但无论是否定义问题,问题都保持不变。

Does anyone know what am I doing wrong? 有谁知道我做错了什么?

如果在导入boost头文件后定义BOOST_PYTHON_ENABLE_STDCALL,则会出现该错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM