// DllUser.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <windows.h>
typedef int (*AddFunc)(int,int);
typedef void (*PrintFunc)();
int main()
{
AddFunc _AddFunc;
PrintFunc _PrintFunc;
//HINSTANCE hInstLibrary = ::LoadLibrary(L"DLLTutorial.dll");
HINSTANCE hInstLibrary =LoadLibraryEx(L"D:\\WorkSpace\\DLLTutorial\\Debug\\DLLTutorial.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
DWORD dwErr = ::GetLastError();
if (hInstLibrary == NULL)
{
FreeLibrary(hInstLibrary);
return 0;
}
_AddFunc = (AddFunc)GetProcAddress(hInstLibrary, "Add");
_PrintFunc = (PrintFunc)GetProcAddress(hInstLibrary, "Print");
if ((_AddFunc == NULL) || (_PrintFunc == NULL))
{
FreeLibrary(hInstLibrary);
}
std::cout << _AddFunc(45, 54) << std::endl;
_PrintFunc();
system("pause");
FreeLibrary(hInstLibrary);
return 1;
}
没有合适的资源?快使用搜索试试~ 我知道了~
免分的,DLL入门例子,大家帮顶
共18个文件
cpp:5个
h:5个
vcxproj:2个
需积分: 10 16 下载量 116 浏览量
2013-06-20
15:47:47
上传
评论
收藏 11KB RAR 举报
温馨提示
DLL的简单入门例子,详细解释见: http://blog.csdn.net/longlong530/article/details/9136895 不要分了,大家帮顶下就好了~^_^
资源推荐
资源详情
资源评论
收起资源包目录
Dll例子.rar (18个子文件)
DLLTutorial
DLLTutorial.sln 1KB
DLLTutorial
dllmain.cpp 393B
DLLTutorial.vcxproj.user 143B
stdafx.h 318B
DLLTutorial.cpp 287B
DLLTutorial.vcxproj 5KB
stdafx.cpp 216B
DLLTutorial.h 282B
targetver.h 236B
DLLTutorial.vcxproj.filters 1KB
DLLTutorial.suo 17KB
DllUser
stdafx.h 233B
stdafx.cpp 212B
targetver.h 236B
DllUser.cpp 900B
DllUser.vcxproj.user 143B
DllUser.vcxproj 4KB
DllUser.vcxproj.filters 1KB
共 18 条
- 1
资源评论
longlong530
- 粉丝: 173
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功