dl 库的 C++ 等效 Windows

标签 c++ dll libdl

我创建了一个使用 OpenSSL 加密解密的应用程序。

要在 g++ 中编译/链接它需要包含静态库:

g++ -o gssag agent_main.cpp libssl.a libcrypto.a -ldl -std=c++14

这个“dl”库似乎是一个加载 LINUX 需要的动态库的库。

我不明白如果使用 *.a 静态库为什么需要它们。但是如果没有这个 ld 库,什么都不起作用。

但是在 Windows 中使用 openssl 和 crypto *.libs g++ linkeditor 也需要 dlopen 函数。

我在windows下用什么来代替linux的dl库???

最佳答案

您需要获取一个 windows openssl dll 并使用 LoadLibrary 函数而不是 dlopen。

HINSTANCE hDllInstance = LoadLibrary(_T("MyDll.dll"));
if(!hDllInstance)
{ /* dll failed to load */ }

关于dl 库的 C++ 等效 Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48286659/

相关文章:

c++ - CEF 在调用特定 DLL 中的函数时崩溃

CRT 与共享库和应用程序的链接

perl - 如何找到模块名称到不透明指针的 DynaLoader 映射?

c++ - 构建 DLL 错误

C++ libdl.so : Can't open shared library in 32bit application

c++ - GTest 的 EXPECT_EQ 给出未定义的错误引用

c++ - 读取部分 Parquet 文件

c++ - SunCC 5.12 到 5.14 和 "Types cannot be declared in anonymous union"

c# - Visual Studio 如何加载库?