Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
616 views
in Technique[技术] by (71.8m points)

dll - Using libdl.so in MinGW

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...