Skip to content

Instantly share code, notes, and snippets.

@deneschen
Created March 9, 2017 16:12
Show Gist options
  • Save deneschen/3988fe374dfbfebd04e183f6673e5c6f to your computer and use it in GitHub Desktop.
Save deneschen/3988fe374dfbfebd04e183f6673e5c6f to your computer and use it in GitHub Desktop.
Python调用Dll
__declspec(dllexport) int test(int len)
{
return len;
}
//注意设置项目属性,编译win32的DLL
//注意也使用32位的Python安装包
import ctypes
#dll = ctypes.windll.LoadLibrary('ConsoleApplication1')
dll = ctypes.CDLL('ConsoleApplication1.dll')
#dll = ctypes.cdll.LoadLibrary( 'ConsoleApplication1.dll' )
print dll.test(111)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment