【发布时间】:2021-03-16 04:17:20
【问题描述】:
我正在尝试使用 pybind11 从 python 中使用第三方 c++ 库。
我已经设法使用纯 C++ 代码做到了,但是,当我添加第三方代码时,我收到以下错误:
ImportError: DLL load failed while importing recfusionbind
这是我的代码:
#include <RecFusion.h>
#include <pybind11/pybind11.h>
using namespace RecFusion;
bool isValidLicense() {
return RecFusionSDK::setLicenseFile("License.dat");
}
namespace py = pybind11;
PYBIND11_MODULE(recfusionbind, m) {
m.def("isValidLicense", &isValidLicense, R"pbdoc(
Check if there is a valid license file.
)pbdoc");
#ifdef VERSION_INFO
m.attr("__version__") = VERSION_INFO;
#else
m.attr("__version__") = "dev";
#endif
}
如果我出于测试目的而更改,将函数返回为简单的true,它就可以正常工作。但是调用第三方库会出现上述错误。我已将 RecFusion.dll 放在当前目录(python 脚本所在的位置),结果相同。
欢迎任何关于我所缺少内容的提示。 Lib 是 64 位的,和我的代码一样。
【问题讨论】:
标签: python c++ windows visual-studio-2019 pybind11