Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using libdl.so in MinGW

Tags:

mingw

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?

like image 842
A23149577 Avatar asked Oct 07 '22 15:10

A23149577


1 Answers

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

like image 73
ingomueller.net Avatar answered Oct 10 '22 18:10

ingomueller.net