www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/09/21:59:18

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: xmalloc and xfree
Date: Sat, 09 Oct 1999 17:56:39 -0700
Organization: Harvey Mudd College
Lines: 31
Message-ID: <37FFE447.91E7700D@hmc.edu>
References: <wkwvsw656d DOT fsf AT mail DOT ndh DOT net>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 939517042 71758 134.173.45.219 (10 Oct 1999 00:57:22 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 10 Oct 1999 00:57:22 GMT
X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.13pre12 i586)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Felix Natter wrote:
> 
> hi,
> I am using xmalloc and xfree
> to allocate memory, but gcc2.95(.1) (2.02, bnu 2.81) gives
> me error messages because it can't find
> xmalloc and xfree (undefined references).
> with gcc-2.81 (2.01, bnu2.81) I always
> got warnings like implicit declaration of xmalloc/xfree,
> but I ignored these since I thought that
> these two functions are included in the startup-code
> and thus wouldn't have a header file.
[snip]

Odd.  One thought: Are you compiling your program as C++?  If so, you
need to declare xmalloc and xfree as `extern "C"'.

It might help if you were to report the exact error message.  (I haven't
got GCC 2.95.x installed here so I can't test it.)

> are xmalloc and xfree deprecated or
> is there a better or more portable (i.e. Linux)
> way to do allocation-checking ?

The most portable way is to write xmalloc and xfree yourself.  It should
take about 30 seconds.  You could even steal them from the libc source,
if your program is going to be GPL.
-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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