包装库函数时,boost python dll加载失败

2024-10-01 15:41:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着用boost.python包装现有的c++代码。我想把它作为一个单独的项目。因此,我用库调用包装函数,如下所示。在

#include < iostream >
#include "stdafx.h"
#include < boost/python/module.hpp >
#include < boost/python/def.hpp >
#include "mylib/header1.hpp"
#include<string>
#include<vector>
#include "umf/header2.hpp"
#include "umf/header3.hpp"

using namespace std;
using namespace boost::python;
using namespace my_ns;


void init(const char* name) {
    cout << "Hiiii " << name << "\n";
    my_ns::initialize();
}

BOOST_PYTHON_MODULE(libname) {
    def("init", init);
}

当我删除my_ns::initialize()行时,包装工作正常。但如果我把它包括在内我就得到

ImportError:DLL加载失败:找不到指定的模块。

我在这里做错什么了?在


Tags: 项目函数代码nameincludeinitmydef

热门问题