用python掉用c++ dll 老是报错:ImportError: No module named hello
hello.dll是用vc.net 2003编译的
创建方式如下:
用向导创建一个win32 dll工程,去掉所有文件,只有一个hello.cpp
代码如下:
#include <boost/python.hpp>
#include <windows.h>
using namespace boost::python;
#pragma comment(lib,"boost_python-vc71-mt-1_33_1")
#pragma comment(lib,"python25.lib")
/*
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
*/
char const* greet()
{
return "hello, world";
}
BOOST_PYTHON_MODULE(hello)
{
def("greet", greet);
}
python调用:
>>> import hello
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
import hello
ImportError: No module named hello
用idle查看了sys.path能找到该dll的路径
请问该问题如何解决