Mail Archives: djgpp-workers/2002/05/16/16:47:00.1
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 -