www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/16/16:47:00.1

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Message-ID: <3CE40159.4E9161C1@yahoo.com>
Date: Thu, 16 May 2002 14:58:33 -0400
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: emacs under w2k
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1020516075834 DOT 13145D-100000 AT is> <559005058 DOT 20020516192217 AT softhome DOT net>
Reply-To: djgpp-workers AT delorie DOT com

Laurynas Biveinis wrote:
> 
> > It's very easy to build Emacs with the library malloc: just add this
> > line to src/config.h:
> 
> >   #define SYSTEM_MALLOC 1
> 
> > (You might also need to add _CRT0_FLAG_FILL_SBRK_MEMORY to
> > _crt0_startup_flags, but I won't recommend doing that unless you see
> > strange problems or aborts.)  To do this with nmalloc, one needs to
> > replace malloc and friends in libc.a with the alternative implementation,
> > or hack src/Makefile to add libnmalloc.a (or whatever it is called) to
> > the link command line.
> 
> Could you explain a bit deeper? What should I do about other
> malloc-related defines in config.h? Do I need unixy sbrk flag in this
> case?

All you have to do is link malloc.o before the library searches. 
No need to alter the libraries etc.

  gcc -o thing.exe thing.o otherthings.o

uses the library, while

  gcc -o thing.exe thing.o otherthings.o malloc.o

uses malloc.o and will never load the library code for it.  In
this case all the crt stuff in the standard library will also use
malloc.o, so it can't do things like call printf etc.

The only entry points to malloc are malloc, free, realloc.  calloc
is in the library, and calls malloc.

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019