我试图调用我在Windows上的visualstudio中用Python创建的一个C dll。在
这是头文件
#pragma once
#ifdef MYCLIB_EXPORT
#define MYCLIB_API extern "C" __declspec(dllexport)
#else
#define MYCLIB_API extern "C" __declspec(dllimport)
#endif
MYCLIB_API int PrintStuff();
以及源文件:
^{pr2}$我正在构建64位调试,在预处理器属性中定义了MYCLIB_导出。我还把MyCLib.dll在Python脚本的目录中。在
我在同一个Visual Studio解决方案中创建了一个Python项目,并具有以下代码:
import ctypes
from ctypes import *
lib = ctypes.WinDLL('MyCLib.dll')
#dll = cdll.LoadLibrary('MyCLib.dll')
print "Done"
当我运行脚本时,我得到错误:[Error 193] %1 is not a valid Win32 application
。在
我是否在创建dll或加载dll时出错?在
目前没有回答
相关问题 更多 >
编程相关推荐