Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: cygwin@cygwin.com
From: Oliver <oliver.schoenborn@utoronto.ca>
Subject: Re: questions about DLL's: .a, .def, and .dll
Date: Fri, 27 Aug 2004 19:39:41 +0000 (UTC)
Lines: 29
Message-ID: <loom.20040827T213303-567@post.gmane.org>
References: <loom.20040827T173827-426@post.gmane.org> <Pine.GSO.4.61.0408271423560.6181@slinky.cs.nyu.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: usenet@sea.gmane.org
X-Gmane-NNTP-Posting-Host: main.gmane.org
User-Agent: Loom/3.14 (http://gmane.org/)
X-Loom-IP: 132.246.8.44 (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0))
X-IsSubscribed: yes

Igor Pechtchanski <pechtcha <at> cs.nyu.edu> writes:

> On Fri, 27 Aug 2004, Oliver wrote:
> 
> > 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.

I guess the .def file might be used if you created your dll in cygwin/mingw but 
are creating your program with VC++ and linking to your non-VC++ dll. (?)

> ...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

Yes. I even tried it on the latest dllhelpers C++ example: just renamed 
dllinit.c to .cc and changed makeit.bat to use g++ instead of gcc, and 
everything still works. Perhaps g++ "knows" to leave DllMain alone? Or perhaps 
the APIENTRY macro that appears just in front of DllMain prevents munging? 

Oliver




--
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/

