简体   繁体   English

如何在 python 中的 DLL 文件中调用函数?

[英]How to call functions inside a DLL file in python?

I'm currently working on a python project that uses functions from a DLL in C#.我目前正在开发一个 python 项目,该项目使用 C# 中的 DLL 中的函数。 I'm trying to use the ctypes module but I'm getting an error:我正在尝试使用 ctypes 模块,但出现错误:

OSError: [WinError 193] %1 is not a valid Win32 application

The code that is giving me the problem is this:给我问题的代码是这样的:

DLL = ctypes.CDLL("c:\\Users\\Hunter1300FC\\Desktop\\MyDLL\\WeAreDevs_API-cpp.dll")

I'm using python 3.8.5 64 bit.我正在使用 python 3.8.5 64 位。

Your DLL file is likely compiled in 32-bit.您的 DLL 文件可能以 32 位编译。 Either load a 64-bit DLL or try with 32-bit python.加载 64 位 DLL 或尝试使用 32 位 python。 You can easily install 32-bit python with miniconda.您可以使用 miniconda 轻松安装 32 位 python。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM