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");
}

运行截图:

最新文章

  1. ubuntu14.04下配置Java环境以及安装最新版本的eclipse
  2. Kosaraju 算法查找强连通分支
  3. 第一个Java程序HelloWorld
  4. 【131031】struts 1 中 &lt;html:form&gt;
  5. Qt Write and Read XML File 读写XML文件
  6. sprint3终极演示
  7. mysql关于字符串字段数据类型
  8. DB2因表空间不够产生load表失败
  9. ASP.NET - Eval使用自定义的方法
  10. tolower (Function)
  11. [转载]sqlserver、Mysql、Oracle三种数据库的优缺点总结
  12. 【安卓开发】Android为什么选择binder
  13. npm管理工具介绍
  14. Web前端 web的学习之路2
  15. JQuery Rest客户端库
  16. 解决linux下访问https站点问题
  17. GDC2017资料整理
  18. python 筛选
  19. Ubantu 查看系统资源占用
  20. ie 8及以下 前端cors ajax跨域须知

热门文章

  1. 紫书 例题11-10 UVa 1349 (二分图最小权完美匹配)
  2. Unity3d 开发(七)AssetBundle组织文件夹
  3. EBS OAF开发中怎样通过ReferenceAO进行验证
  4. [转]GLTF-3D图形界的JPEG
  5. 创建一个Spring的HelloWorld程序
  6. poj_1195Mobile phones,二维树状数组
  7. 49.AngularJs 指令directive之controller,link,compile
  8. linux中不同颜色的文件代表什么不同的类型
  9. c# 对用户密码加密解密
  10. 细说ReactiveCocoa的冷信号与热信号(一)