22.dll调用技术
2024-09-22 02:45:23
1.dll文件:
#include <Windows.h> _declspec(dllexport) void message_hello()
{
MessageBoxA(, "hello", "hello", );
} _declspec(dllexport) double add(double num1, double num2)
{
return num1 + num2;
}
2.调用dll文件
#include <stdlib.h>
#include <Windows.h> void main()
{
HMODULE mod = LoadLibraryA("工具.dll");
if (mod == NULL)
{
printf("load error\n");
exit();
} //获取函数地址
void(*message_hello)() = (void(*)())GetProcAddress(mod, "message_hello");
double(*add)(double, double) = (double(*)(double, double))GetProcAddress(mod, "add"); //调用函数
if (message_hello == NULL)
{
printf("find error\n");
}
else
{
message_hello();
} if (add == NULL)
{
printf("find error\n");
}
else
{
printf("%f",add(,));
}
system("pause");
}
运行截图:
最新文章
- ubuntu14.04下配置Java环境以及安装最新版本的eclipse
- Kosaraju 算法查找强连通分支
- 第一个Java程序HelloWorld
- 【131031】struts 1 中 <;html:form>;
- Qt Write and Read XML File 读写XML文件
- sprint3终极演示
- mysql关于字符串字段数据类型
- DB2因表空间不够产生load表失败
- ASP.NET - Eval使用自定义的方法
- tolower (Function)
- [转载]sqlserver、Mysql、Oracle三种数据库的优缺点总结
- 【安卓开发】Android为什么选择binder
- npm管理工具介绍
- Web前端 web的学习之路2
- JQuery Rest客户端库
- 解决linux下访问https站点问题
- GDC2017资料整理
- python 筛选
- Ubantu 查看系统资源占用
- ie 8及以下 前端cors ajax跨域须知
热门文章
- 紫书 例题11-10 UVa 1349 (二分图最小权完美匹配)
- Unity3d 开发(七)AssetBundle组织文件夹
- EBS OAF开发中怎样通过ReferenceAO进行验证
- [转]GLTF-3D图形界的JPEG
- 创建一个Spring的HelloWorld程序
- poj_1195Mobile phones,二维树状数组
- 49.AngularJs 指令directive之controller,link,compile
- linux中不同颜色的文件代表什么不同的类型
- c# 对用户密码加密解密
- 细说ReactiveCocoa的冷信号与热信号(一)