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: Fri, 27 Aug 2004 14:28:00 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Oliver cc: cygwin AT cygwin DOT com Subject: Re: questions about DLL's: .a, .def, and .dll In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.39 On Fri, 27 Aug 2004, Oliver wrote: > Hi folks, I'm confused about the files that dllwrap > creates. On Unix (where I've been programming forever) all you > have to do is create a .so shared library. But dllwrap ends up > creating a .a file, a .def file, and a .dll file, yet I can > build a program that links to, e.g., mylib.dll, with only "-L. -lmylib", > *wihtout* having the .def or .a available. So where and when are the .a and > .def files needed? The newer versions of gcc apparently allow you to link directly to a .dll file. The .def and .a are needed for older versions of gcc, and possibly for some other tools. > Also, I read in the various docs (dllhelpers etc) that you have to > compile the file that has DllMain using either "extern 'C'" around the > DllMain function, or make it a C file rather than a c++ file and compile > with gcc, yet it worked for me as a c++ file without the extern, is this > new behavior or is something going to blow up on me later? The reason you want an 'extern "C"' for DLL functions in general is that g++ and the Windows C++ compilers (notably VC++) use different name munging schemes, so a DLL built with C++ symbols won't be usable from other applications that try to call those functions. The reason you want it for DllMain is that the Windows loader will be looking for the unmunged name "DllMain". Are you sure that it's really invoked when the DLL is loaded? Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Happiness lies in being privileged to work hard for long hours in doing whatever you think is worth doing." -- Dr. Jubal Harshaw -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/