2024-05-23 服务器开发-windows-加载dll动态库

摘要:

2024-05-23 服务器开发-windows-加载dll动态库

使用 LoadLibrary

cpp 复制代码
	HMODULE mdl = ::LoadLibrary(L"mylib.dll");
	if (!mdl)
	{
		auto err = ::GetLastError();
		std::cout << "ERROR: load VxCfgClient fail, error: " << err << std::endl;
		return -1;
	}

使用dll中的函数

cpp 复制代码
typedef  int* (*Func)(int*);		
    

    Func func = 
		(Func)GetProcAddress(mdl, "myFunc");


	if (!func)
	{
		auto err = ::GetLastError();
		std::cout << "ERROR: get funcfail, error: " << err << std::endl;
		return -1;
	}
相关推荐
Sinclair1 天前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
Rockbean2 天前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
蝎子莱莱爱打怪3 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
埃博拉酱3 天前
VS Code Remote SSH 连接 Windows 服务器卡在"下载 VS Code 服务器":prcdn DNS 解析失败的诊断与 BITS 断点续传
windows·ssh·visual studio code
茶杯梦轩3 天前
CompletableFuture 在 项目实战 中 创建异步任务 的核心优势及使用场景
服务器·后端·面试
唐宋元明清21883 天前
.NET 本地Db数据库-技术方案选型
windows·c#
海天鹰3 天前
【免费】PHP主机=域名+解析+主机
服务器
DianSan_ERP3 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
加号33 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql
tryCbest3 天前
Windows环境下配置pip镜像源
windows·pip