Mail Archives: djgpp/1999/10/09/21:59:18
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 -