动态模块没有仅用python2.2定义init函数

2024-06-28 19:32:27 发布

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

动态错误module does not define init function (initsomething)有问题。 当我使用Python2.7时一切正常,问题只出现在使用Python2.2编译时 输出格式为.pyd。 我的c++代码

#ifndef PyMODINIT_FUNC
#define PyMODINIT_FUNC void
#endif

extern "C" PyMODINIT_FUNC initsomething(void)
{
    (void)Py_InitModule("something", methods);
}

Tags: 代码init格式notfunctionpydmodulefunc