From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Harald.Maier.BW@t-online.de Newsgroups: gmane.emacs.devel Subject: Re: [jay_finger@hotmail.com: Two problems in Emacs-21.2.91 on Windows] Date: Mon, 28 Oct 2002 06:57:42 +0100 Sender: emacs-devel-admin@gnu.org Message-ID: References: Reply-To: Harald Maier NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035784842 26661 80.91.224.249 (28 Oct 2002 06:00:42 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 28 Oct 2002 06:00:42 +0000 (UTC) Cc: emacs-devel@gnu.org, emacs-pretest-bug@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1862x6-0006vs-00 for ; Mon, 28 Oct 2002 07:00:40 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 186315-0005ep-00 for ; Mon, 28 Oct 2002 07:04:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 1862vj-0005BY-00; Mon, 28 Oct 2002 00:59:15 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 1862uX-0003GQ-00 for emacs-devel@gnu.org; Mon, 28 Oct 2002 00:58:01 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 1862uU-0003GF-00 for emacs-devel@gnu.org; Mon, 28 Oct 2002 00:58:00 -0500 Original-Received: from mailout05.sul.t-online.com ([194.25.134.82]) by monty-python.gnu.org with esmtp (Exim 4.10) id 1862uR-0003Fx-00; Mon, 28 Oct 2002 00:57:56 -0500 Original-Received: from fwd06.sul.t-online.de by mailout05.sul.t-online.com with smtp id 1862uQ-0006e2-00; Mon, 28 Oct 2002 06:57:54 +0100 Original-Received: from HESTIA (320041125923-0001@[217.230.87.98]) by fwd06.sul.t-online.com with esmtp id 1862uH-1s5O6KC; Mon, 28 Oct 2002 06:57:45 +0100 Original-To: jay_finger@hotmail.com Original-Lines: 72 User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.91 (i386-mingw-nt5.0.2195) X-Sender: 320041125923-0001@t-dialin.net Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:8838 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:8838 Richard Stallman writes: > Any ideas for what to do here? > > From: "Jay Finger" > Subject: Two problems in Emacs-21.2.91 on Windows > > ... > > 1) When building with MSVC 7: > > A linker error comes up complaining about multiply defined symbols for > _heap_init and _heap_term. These are both defined in w32heap.c, apparently > to prevent the functions with that name in the CRT from initializing the > heap. In the MSVC 7 libc.lib there are a couple of additional symbols > defined in the object with these functions that cause that object to get > sucked in, whereas it didn't used to get included. Simply removing > libc.lib(heapinit.obj) from the library creates it's own problems as it > removes other symbols needed by the CRT. > > I found two hacks that seem to work, but I don't really like either because > there are sure to be issues I don't understand: > > Linking with the libc.lib from MSVC 6 works: it links, Emacs seems to work > fine (I haven't played with any features added since 21.1.1, what I've been > running). I don't like this, though, since it requires hacking the build > environment, and there may be dependencies between the compiler and libc.lib > that I'm unaware of. (You definitely need the V7 libc.lib if you want to > compile with the /GS option, which was invaluable for finding the stack > corruption described below). > > The other hack that seems to work OK (it links and runs with caveats as > above), is to just remove the definitions of _heap_init and _heap_term from > w32heap.c. The comment above those says "They are normally defined by the > runtime, but we override them here so that the unnecessary HeapCreate call > is not performed." If it's just an extra heap that we're worried about, > this should be slightly wasteful but harmless. But maybe there is some > problem caused by having that heap initialized that the comment doesn't > record? I activated your later approach and this works fine. Personally, I would take that approach beacause this works with less pain. Here a patch with that compiling and linking works fine with MSVC 7. This is only tested with the current development sources. Harald Index: w32heap.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/w32heap.c,v retrieving revision 1.21 diff -c -r1.21 w32heap.c *** w32heap.c 1 Jan 2002 19:10:04 -0000 1.21 --- w32heap.c 27 Oct 2002 16:50:10 -0000 *************** *** 282,288 **** sbrk (need_to_alloc); } ! #if (_MSC_VER >= 1000 && !defined(USE_CRT_DLL)) /* MSVC 4.2 invokes these functions from mainCRTStartup to initialize a heap via HeapCreate. They are normally defined by the runtime, --- 282,288 ---- sbrk (need_to_alloc); } ! #if (_MSC_VER >= 1000 && _MSC_VER < 1300 && !defined(USE_CRT_DLL)) /* MSVC 4.2 invokes these functions from mainCRTStartup to initialize a heap via HeapCreate. They are normally defined by the runtime,