在MinGW中使用libdl.so [英] Using libdl.so in MinGW
问题描述
g ++ xx.o yy.o /usr/lib/libdl.so -o module.so
但在MinGW中,我不知道如何添加此对象。任何想法?
有一个 libdl的MinGW端口,可以像Unix一样使用。来自网站的引用:
此库为POSIX和SUS中指定的dlfcn实现包装,围绕动态链接库函数Windows API。
它需要MinGW来构建。
您可以获取预构建的二进制文件gcc 3.4.5)和下载部分的捆绑源代码。
以下命令构建并安装在标准MinGW安装(从MinGW shell运行):
./ configure --prefix = / --libdir = / lib --incdir =包括&&制作&& make install
要将库编译为DLL,请使用以下命令:
g ++ -shared xx.o yy.o -ldl -o module.dll
I want to generate a dll file in MinGW, I have several object dependencies in order to do that, one of my object dependencies is libdl.so, I add this object in unix simply as :
g++ xx.o yy.o /usr/lib/libdl.so -o module.so
but in MinGW, I don't have any idea how to add this object. any ideas?
There is a MinGW port of libdl that you can use just like under Unix. Quote from the website:
This library implements a wrapper for dlfcn, as specified in POSIX and SUS, around the dynamic link library functions found in the Windows API.
It requires MinGW to build.
You may get pre-built binaries (with MinGW gcc 3.4.5) and a bundled source code from the Downloads section.
The following commands build and install it in a standard MinGW installation (to be run from your MinGW shell):
./configure --prefix=/ --libdir=/lib --incdir=/include && make && make install
To compile your library as a DLL, use the following command:
g++ -shared xx.o yy.o -ldl -o module.dll
这篇关于在MinGW中使用libdl.so的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!