www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/09/11:11:37

From: Felix Natter <f DOT natter AT ndh DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: xmalloc and xfree
Date: 09 Oct 1999 15:21:14 +0200
Organization: Customer of NDH Netzwerkdienste Hoeger GmbH
Message-ID: <wkwvsw656d.fsf@mail.ndh.net>
NNTP-Posting-Host: port253.bonn.ndh.net
Mime-Version: 1.0
X-Trace: passat.ndh.net 939474969 1895 195.94.93.253 (9 Oct 1999 13:16:09 GMT)
X-Complaints-To: abuse AT ndh DOT net
NNTP-Posting-Date: 9 Oct 1999 13:16:09 GMT
User-Agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4
Lines: 46
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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.

here's an example:
the header files I've included and
the prototypes
are just attempts to find one where xfree
and xmalloc are defined in, because
I thought that the problem might be that
the compiler can't find a definition,
and thus uses the "implicit declarations"
which in turn won't be recognized by
the compiler at link-time ??

------------------------
#include <stdlib.h>
#include <sys/djtypes.h>
#include <sys/types.h>
#include <stddef.h>

int xmalloc(size_t size);
void xfree(void* buffer);

int main() {
  char *buffer = (char*)xmalloc(1000);
  xfree(buffer);
  return 0;
}
-----------------------

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

thanks,
---
Felix Natter

- Raw text -


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