I am describing how to link dll in the Cygwin environment here. This is so basic for most of the people who are using Cygwin, I guess. :-)


Under Windows, suppose you are going to develop anything without your favourate development environment, gcc emacs vi, Cygwin definitely will become a very good choice for us. However, we are not always relying on the libraries supplied with Cygwin. We will need Windows style library dll files. Then how do we link them wil Gcc?

We will need pexports and dlltool.

First, we use pexport to generate the def file.

http://www.emmestech.com/software/cygwin/pexports-0.43/moron1.html

Then, use dlltool to create the dynamic link library file that can be recognized by cygwin.

Example in my case, to use my DAQ card, there is a dll file:

$ pexports.exe filename.dll > filename.def
$ dlltool.exe --dllname filename.dll --def filename.def --output-lib libfilename.a


Terribly say that I have not tried to test the program working or not. I just successfully compiled the program... :-O

-----------------------Reference--------

--------------------------
http://www.emmestech.com/software/cygwin/pexports-0.43/moron1.html
http://sebsauvage.net/python/mingw.html Something related for Python Swig Cygwin
http://www.gnu.org/software/binutils/manual/html_chapter/binutils_13.html
---------------------------------------------------------------------