From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Rumney Newsgroups: gmane.emacs.devel Subject: Re: Compilation problems with latest MSVC Date: Sun, 31 Dec 2006 00:13:18 +0000 Message-ID: <4597009E.4040809@gnu.org> References: <4eb0089f0612281840x5f814fb1jd7c09e6182601e4f@mail.gmail.com> <4eb0089f0612281901o27849654k58dfaf73e73783d9@mail.gmail.com> <4595415F.1060708@gnu.org> <4595A815.5060403@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1167524026 26332 80.91.229.12 (31 Dec 2006 00:13:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 31 Dec 2006 00:13:46 +0000 (UTC) Cc: emacs-devel@gnu.org, drobinow@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 31 01:13:43 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H0oKc-0000od-BI for ged-emacs-devel@m.gmane.org; Sun, 31 Dec 2006 01:13:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H0oKb-0003HY-OW for ged-emacs-devel@m.gmane.org; Sat, 30 Dec 2006 19:13:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H0oKM-0003FD-0n for emacs-devel@gnu.org; Sat, 30 Dec 2006 19:13:26 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H0oKK-0003EQ-6S for emacs-devel@gnu.org; Sat, 30 Dec 2006 19:13:25 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H0oKK-0003EI-2o for emacs-devel@gnu.org; Sat, 30 Dec 2006 19:13:24 -0500 Original-Received: from [194.106.33.237] (helo=outmail1.freedom2surf.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H0oKI-0005lZ-Al; Sat, 30 Dec 2006 19:13:22 -0500 Original-Received: from [127.0.0.1] (i-83-67-23-108.freedom2surf.net [83.67.23.108]) by outmail1.freedom2surf.net (Postfix) with ESMTP id BF6ED54CD8; Sun, 31 Dec 2006 00:13:21 +0000 (GMT) User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) Original-To: Eli Zaretskii In-Reply-To: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:64536 Archived-At: Eli Zaretskii wrote: >> Date: Fri, 29 Dec 2006 23:43:17 +0000 >> From: Jason Rumney >> Cc: drobinow@gmail.com, emacs-devel@gnu.org >> >> The crash is happening within the initialization code before any Emacs >> code gets run (__tmainCRTStartup). This code is calling _free_internal, >> which we are redefining in gmalloc.c. >> > > That rings a bell: during linking, the linker complained about > multiple definitions of some memory-related functions, I think calloc > and realloc. Did you have those warnings in your build? > Yes, they appear as errors if you link against libcmt.lib, unless you include -force:multiple in LINK_FLAGS. I suspect that the single threaded library is required for Emacs, as the multithreaded library will be allocating heap memory for each thread behind your back to avoid problems with global variables, so there will always be a conflict between Emacs's and the C library's malloc routines. I also tried linking against msvcrt.lib (the dynamic linked version of libcmt). It doesn't complain about the multiple definitions, but there are more unresolved symbols. I also recall Andrew Innes trying in the past to get Emacs working with the dynamic linked c runtime, I'm not sure if he succeeded in the end by ensuring that Emacs's memory allocations do not intertwine with the system library's or whether he gave up.