Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Tue, 20 Aug 2002 21:28:22 -0500 From: Joshua Daniel Franklin X-X-Originator: joshua AT joshua DOT iocc DOT com Reply-To: Joshua Daniel Franklin To: cygwin AT cygwin DOT com Subject: Updating dll info in the User's Guide Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Gerrit and other dll-builders, Thanks for the update on dll-building. I almost missed this one... I was thinking "Why doesn't someone just update the documentation?" then realized "Hey, I volunteered to do that, didn't I?" (BTW, everyone--could I get heads-up about the User's Guide like David gets about the FAQ?) Here is some new text to replace the section at http://cygwin.com/cygwin-ug-net/dll.html that begins with "Unfortunately, the process for building a dll is, well, convoluted. You have to run five commands, like this" This is not the actual patch, I will submit one of those after I verify that I've got the subject matter correct. Please read carefully since I'm not an expert in this area and may have mixed up some terminology or concepts. --------Begin new text-------- Fortunately, with the latest gcc and binutils the process for building a dll is now much simpler. Say you want to build this minimal function in mydll.c: #include int WINAPI mydll_init(HANDLE h, DWORD reason, void *foo) { return 1; } First compile mydll.c to object code: gcc -c mydll.c Then, tell gcc that it is building a shared library: gcc -shared -o mydll.dll mydll.o That's it! However, if you are building a dll as an export library, you will probably want to use the complete syntax: gcc -shared -o cyg${module}.dll \ -Wl,--out-implib=lib${module}.dll.a \ -Wl,--export-all-symbols \ -Wl,--enable-auto-import \ -Wl,--whole-archive ${old_lib} \ -Wl,--no-whole-archive ${dependency_libs} Where ${module} is the name of your DLL, ${old_lib} are all your object files, bundled together in static libs or single object files and the ${dependency_libs} are import libs you need to link against, e.g '-lpng -lz -L/usr/local/special -lmyspeciallib' --------End new text-------- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/