c++生成dll使用python调用dll的方法
时间:2023-02-16 11:40:05
第一步,建立一个CPP的DLL工程,然后写如下代码,生成DLL
#include <stdio.h>
#define DLLEXPORT extern "C" __declspec(dllexport)
DLLEXPORT int __stdcall hello()
{
printf("Hello world!\n");
return 0;
}
第二步,编写一个 python 文件:
# coding: utf-8
import os
import ctypes
CUR_PATH = os.path.dirname(__file__)
if __name__ == '__main__':
print 'starting...'
dll = ctypes.WinDLL(os.path.join(CUR_PATH, 'hello.dll'))
dll.hello()
标签:调用dll
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python计算n的阶乘的方法代码
2023-08-20 07:33:00
计算Python Numpy向量之间的欧氏距离实例
2022-08-14 08:21:56
![](https://img.aspxhome.com/file/2023/7/91857_0s.jpg)
怎样正确的解决 MySQL 中文模糊检索问题
2008-12-19 17:26:00
asp MD5加密方式使用建议
2011-03-30 11:17:00
Vue报错Module build failed: Error: Node Sass version 7.0.1 is incompatible with 4.0.0.解决方案
2023-07-02 17:06:16
![](https://img.aspxhome.com/file/2023/7/139927_0s.png)
Opencv-Python图像透视变换cv2.warpPerspective的示例
2023-06-27 19:03:18
![](https://img.aspxhome.com/file/2023/2/98842_0s.gif)
PHP Web木马扫描器代码 v1.0 安全测试工具
2024-04-29 13:58:09
TensorFlow实现创建分类器
2022-03-02 03:15:43
![](https://img.aspxhome.com/file/2023/4/104914_0s.jpg)
解决python通过cx_Oracle模块连接Oracle乱码的问题
2023-04-30 23:25:45
基于python+selenium自动健康打卡的实现代码
2022-04-28 06:31:28
![](https://img.aspxhome.com/file/2023/0/90780_0s.png)
mysql执行时间为负数的原因分析
2024-01-19 12:21:20
原生JS实现匀速图片轮播动画
2024-06-07 15:28:15
![](https://img.aspxhome.com/file/2023/9/122589_0s.jpg)
Python基于动态规划算法计算单词距离
2021-09-18 11:18:16
细化解析:怎样把你的MySQL完全中文化
2008-12-19 17:48:00
在自动化中用python实现键盘操作的方法详解
2021-02-04 00:23:48
对Python中DataFrame按照行遍历的方法
2023-01-03 23:08:59
如何修改Editplus让图片自适应界面大小
2007-09-26 12:37:00
IntelliJ IDEA下的SVN使用(傻瓜式教学)
2023-07-20 05:36:58
![](https://img.aspxhome.com/file/2023/0/131830_0s.png)
两个table之间相互移动数据
2024-04-10 13:50:56
web标准:CSS clear的属性及使用方法
2008-10-27 13:31:00